jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Mojo's Cassandra Maven Plugin
  • Mojo's Cassandra Maven Plugin
  • MCASSANDRA-15

Whitespace in path breaks execution

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0.0-1
  • Fix Version/s: 1.1.0-1
  • Labels:
    None
  • Environment:
    Windows XP
  • Number of attachments :
    0

Description

Failed to execute goal org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1:start (default) on project cassandra-integration-test: Illegal character in path at index 18: file:/C:/Documents and Settings/user/workspace/cassandra-integration-test/target/cassandra/conf/log4j-server.properties

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Andrew Swan added a comment - 04/Apr/12 11:13 PM

This bug doesn't just affect Windows users; we have a Hudson server running a CI build upon each commit. If we have any spaces in the Hudson job name, for example "Stealth Project JVM Core - Post-Commit", we get the same error. FYI, here's the stack trace:

[ERROR] Failed to execute goal org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1:start (default) on project com.example: Illegal character in path at index 39:  file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1:start (default) on project com.example: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties
	at org.codehaus.mojo.cassandra.StartCassandraMojo.execute(StartCassandraMojo.java:116)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: java.io.IOException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties
	at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:595)
	at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:566)
	at org.codehaus.mojo.cassandra.StartCassandraMojo.execute(StartCassandraMojo.java:82)
	... 21 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties
	at java.net.URI$Parser.fail(URI.java:2809)
	at java.net.URI$Parser.checkChars(URI.java:2982)
	at java.net.URI$Parser.parseHierarchical(URI.java:3066)
	at java.net.URI$Parser.parse(URI.java:3014)
	at java.net.URI.<init>(URI.java:578)
	at java.net.URL.toURI(URL.java:918)
	at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:590)
	... 23 more

I'll check out the source of this plugin to see if I can contribute a patch.

Show
Andrew Swan added a comment - 04/Apr/12 11:13 PM This bug doesn't just affect Windows users; we have a Hudson server running a CI build upon each commit. If we have any spaces in the Hudson job name, for example "Stealth Project JVM Core - Post-Commit", we get the same error. FYI, here's the stack trace: [ERROR] Failed to execute goal org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1:start ( default ) on project com.example: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1:start ( default ) on project com.example: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoExecutionException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties at org.codehaus.mojo.cassandra.StartCassandraMojo.execute(StartCassandraMojo.java:116) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.io.IOException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:595) at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:566) at org.codehaus.mojo.cassandra.StartCassandraMojo.execute(StartCassandraMojo.java:82) ... 21 more Caused by: java.net.URISyntaxException: Illegal character in path at index 39: file:/opt/hudson/workspace/jobs/Stealth Project JVM Core - Post-Commit/workspace/com.example/target/cassandra/conf/log4j-server.properties at java.net.URI$Parser.fail(URI.java:2809) at java.net.URI$Parser.checkChars(URI.java:2982) at java.net.URI$Parser.parseHierarchical(URI.java:3066) at java.net.URI$Parser.parse(URI.java:3014) at java.net.URI.<init>(URI.java:578) at java.net.URL.toURI(URL.java:918) at org.codehaus.mojo.cassandra.AbstractCassandraMojo.newServiceCommandLine(AbstractCassandraMojo.java:590) ... 23 more I'll check out the source of this plugin to see if I can contribute a patch.
Hide
Permalink
Mikhail Mazursky added a comment - 05/Apr/12 6:23 AM

Fix seems to be trivial (but that is probably not all the code that should be patched - decoding may also need review):

org.codehaus.mojo.cassandra.AbstractCassandraMojo line 590 and 591

args.add("-Dlog4j.configuration="
+ new File(new File(cassandraDir, "conf"), "log4j-server.properties").toURL().toURI().toString());

should be

args.add("-Dlog4j.configuration="
+ new File(new File(cassandraDir, "conf"), "log4j-server.properties").toURI().toString());

Just tested it:

File f = new File("/etc/path with spaces");
System.out.println(f.toURI().toString());
System.out.println(f.toURL().toURI().toString());

Output:

file:/etc/path%20with%20spaces
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 14: file:/etc/path with spaces
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URL.toURI(URL.java:918)

Show
Mikhail Mazursky added a comment - 05/Apr/12 6:23 AM Fix seems to be trivial (but that is probably not all the code that should be patched - decoding may also need review): org.codehaus.mojo.cassandra.AbstractCassandraMojo line 590 and 591 args.add("-Dlog4j.configuration=" + new File(new File(cassandraDir, "conf"), "log4j-server.properties").toURL().toURI().toString()); should be args.add("-Dlog4j.configuration=" + new File(new File(cassandraDir, "conf"), "log4j-server.properties").toURI().toString()); Just tested it: File f = new File("/etc/path with spaces"); System.out.println(f.toURI().toString()); System.out.println(f.toURL().toURI().toString()); Output: file:/etc/path%20with%20spaces Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 14: file:/etc/path with spaces at java.net.URI$Parser.fail(URI.java:2809) at java.net.URI$Parser.checkChars(URI.java:2982) at java.net.URI$Parser.parseHierarchical(URI.java:3066) at java.net.URI$Parser.parse(URI.java:3014) at java.net.URI.<init>(URI.java:578) at java.net.URL.toURI(URL.java:918)
Hide
Permalink
Andrew Swan added a comment - 09/Apr/12 8:15 PM

Mikhail, your change fixes the problem with log4j-server.properties. However a few lines further down, there's a problem with resolving the path to cassandra.jar (when that path contains spaces):

AbstractCassandraMojo.java
args.add("-jar");
args.add(new File(new File(cassandraDir, "bin"), "cassandra.jar").toString());

Giving rise to:

[INFO] --- cassandra-maven-plugin:1.0.0-1:start (default) @ using-cassandra-plugin ---
[INFO] Waiting for Cassandra to start...
[INFO] Unable to access jarfile "/my spaced project/target/cassandra/bin/cassandra.jar"
[INFO] Cassandra not running!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

One workaround to both the above problems is to change the Cassandra directory via configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cassandra-maven-plugin</artifactId>
    <version>1.0.0-1</version>
    <configuration>
        <cassandraDir>/some/path/with/no/spaces</cassandraDir>
    </configuration>
</plugin>

The only pitfall with this approach is that you need to clean this directory manually; it won't automatically be cleaned up during the Maven "clean" phase, unlike anything located under the "target" directory.

Show
Andrew Swan added a comment - 09/Apr/12 8:15 PM Mikhail, your change fixes the problem with log4j-server.properties . However a few lines further down, there's a problem with resolving the path to cassandra.jar (when that path contains spaces): AbstractCassandraMojo.java args.add( "-jar" ); args.add( new File( new File(cassandraDir, "bin" ), "cassandra.jar" ).toString()); Giving rise to: [INFO] --- cassandra-maven-plugin:1.0.0-1:start ( default ) @ using-cassandra-plugin --- [INFO] Waiting for Cassandra to start... [INFO] Unable to access jarfile "/my spaced project/target/cassandra/bin/cassandra.jar" [INFO] Cassandra not running! [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ One workaround to both the above problems is to change the Cassandra directory via configuration: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cassandra-maven-plugin</artifactId> <version>1.0.0-1</version> <configuration> <cassandraDir>/some/path/with/no/spaces</cassandraDir> </configuration> </plugin> The only pitfall with this approach is that you need to clean this directory manually; it won't automatically be cleaned up during the Maven "clean" phase, unlike anything located under the "target" directory.
Hide
Permalink
Stephen Connolly added a comment - 02/May/12 3:57 AM

r16515

Show
Stephen Connolly added a comment - 02/May/12 3:57 AM r16515
Hide
Permalink
Robert Scholte added a comment - 02/May/12 1:44 PM

I've run the ITs on my Win7 machine, they all succeed.

Show
Robert Scholte added a comment - 02/May/12 1:44 PM I've run the ITs on my Win7 machine, they all succeed.
Hide
Permalink
Andrew Swan added a comment - 08/May/12 7:23 PM

I've run the plugin on a project with a space in its path, and the fix works, thanks very much (Mac OS X 10.6.8).

Show
Andrew Swan added a comment - 08/May/12 7:23 PM I've run the plugin on a project with a space in its path, and the fix works, thanks very much (Mac OS X 10.6.8).

People

  • Assignee:
    Stephen Connolly
    Reporter:
    Mikhail Mazursky
Vote (1)
Watch (0)

Dates

  • Created:
    17/Dec/11 12:11 AM
    Updated:
    08/May/12 7:23 PM
    Resolved:
    02/May/12 3:57 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.