Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1755 #1775

Merged
merged 2 commits into from
Dec 8, 2017
Merged

Fixes #1755 #1775

merged 2 commits into from
Dec 8, 2017

Conversation

kaspersorensen
Copy link
Member

Fixes #1755.

Here's a test case console dump:

$ ./datacleaner.sh -ds orderdb -t customers -list columns
Using DATACLEANER_HOME: /c/Users/kasper/git/datacleaner/desktop/ui/target/DataCleaner
Using DATACLEANER_LIB_HOME: /c/Users/kasper/git/datacleaner/desktop/ui/target/DataCleaner
Using DATACLEANER_JAVA_OPTS:  -Xmx1024m
INFO  20:02:21 DataCleanerHome - Initializing DATACLEANER_HOME
INFO  20:02:22 DataCleanerHome - Resolved env. variable DATACLEANER_HOME: C:/Users/kasper/git/datacleaner/desktop/ui/target/DataCleaner
Using default log configuration: jar:file:/C:/Users/kasper/git/DataCleaner/desktop/ui/target/DataCleaner/DataCleaner.jar!/org/datacleaner/log4j-default.xml
Failed to load DataCleaner version from manifest: null
Failed to load DataCleaner version from manifest: null
Columns:
--------
CUSTOMERNUMBER
CUSTOMERNAME
CONTACTLASTNAME
...

@LosD
Copy link
Contributor

LosD commented Dec 5, 2017

LGTM. I'll try it out tonight. I remember there being a problem around quoted multi-word files and $* vs $@, though $@ might very well have been the solution, but I'd still like to prod a bit at it. :)

@LosD
Copy link
Contributor

LosD commented Dec 5, 2017

This did not work properly in my Git-Bash shell on Windows, but that seems to be an artifact of the Git-Bash translations (it does quite a bit of funny stuff to make Unix-like paths work):

$ ./datacleaner.sh -conf "/c/Users/Dennis/.datacleaner/hey look spaces/" -list datastores
Using DATACLEANER_HOME: /c/Users/Dennis/Documents/Git/DataCleaner/desktop/ui/target/DataCleaner
Using DATACLEANER_LIB_HOME: /c/Users/Dennis/Documents/Git/DataCleaner/desktop/ui/target/DataCleaner
Using DATACLEANER_JAVA_OPTS:  -Xmx1024m
INFO  23:04:20 DataCleanerHome - Initializing DATACLEANER_HOME
INFO  23:04:20 DataCleanerHome - Resolved env. variable DATACLEANER_HOME: C:/Users/Dennis/Documents/Git/DataCleaner/desktop/ui/target/DataCleaner
Using default log configuration: jar:file:/C:/Users/Dennis/Documents/Git/DataCleaner/desktop/ui/target/DataCleaner/DataCleaner.jar!/org/datacleaner/log4j-default.xml
Failed to load DataCleaner version from manifest: null
Failed to load DataCleaner version from manifest: null
ERROR 23:04:21 Bootstrap - An unexpected error has occurred during bootstrap. Exiting with status code -2.
com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, org.apache.metamodel.util.ResourceException: org.apache.commons.vfs2.FileNotFoundException: Could not read from "file:///C:/Users/Dennis/.datacleaner/hey" because it is not a file.
  at org.datacleaner.guice.DCModuleImpl.getDataCleanerConfiguration(DCModuleImpl.java:254)
  while locating org.datacleaner.configuration.DataCleanerConfiguration

1 error
        at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
        at org.datacleaner.bootstrap.Bootstrap.runInternal(Bootstrap.java:177)
        at org.datacleaner.bootstrap.Bootstrap.run(Bootstrap.java:92)
        at org.datacleaner.Main.main(Main.java:165)
        at org.datacleaner.Main.main(Main.java:150)
Caused by: org.apache.metamodel.util.ResourceException: org.apache.commons.vfs2.FileNotFoundException: Could not read from "file:///C:/Users/Dennis/.datacleaner/hey" because it is not a file.
        at org.datacleaner.util.VfsResource.read(VfsResource.java:117)
        at org.apache.metamodel.util.AbstractResource.read(AbstractResource.java:58)
        at org.datacleaner.configuration.DomConfigurationWriter.<init>(DomConfigurationWriter.java:89)
        at org.datacleaner.guice.DCModuleImpl$2.<init>(DCModuleImpl.java:315)
        at org.datacleaner.guice.DCModuleImpl.createConfigurationWriter(DCModuleImpl.java:315)
        at org.datacleaner.guice.DCModuleImpl.getDataCleanerConfiguration(DCModuleImpl.java:258)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
        at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
        at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
        ... 5 more
Caused by: org.apache.commons.vfs2.FileNotFoundException: Could not read from "file:///C:/Users/Dennis/.datacleaner/hey" because it is not a file.
        at org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1309)
        at org.apache.commons.vfs2.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:411)
        at org.datacleaner.util.VfsResource.read(VfsResource.java:115)
        ... 19 more
Caused by: java.io.FileNotFoundException: C:\Users\Dennis\.datacleaner\hey (The system cannot find the file specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.apache.commons.vfs2.provider.local.LocalFile.doGetInputStream(LocalFile.java:241)
        at org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1301)
        ... 21 more

(notice the weird path).

Can I get you to repeat the test on a proper Unix, just to make sure it works? If that works, 👍 from me.

@LosD
Copy link
Contributor

LosD commented Dec 5, 2017

Wait! I actually screwed up (forgot to add /conf.xml), but it still failed after fixing it. And that's not due to Git-Bash:
You need to quote the $@. After adding quotes to datacleaner.sh (so that it's exec java $DATACLEANER_JAVA_OPTS -jar $DATACLEANER_LIB_HOME/DataCleaner.jar "$@"), it worked perfectly. And that seems to be the general solution: https://stackoverflow.com/questions/17094086/passing-arguments-with-spaces-between-bash-script (you need to read the comments to the accepted answer as well for the final conclusion :))

@kaspersorensen
Copy link
Member Author

Fixed :-)

@LosD
Copy link
Contributor

LosD commented Dec 8, 2017

Works for me now! :)

@LosD LosD merged commit 345dcba into master Dec 8, 2017
@LosD LosD deleted the bug/1755-cli-arguments-with-sh-script branch December 8, 2017 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants