Author: dfabulich Date: Fri Nov 23 08:02:56 2007 New Revision: 597693 URL: http://svn.apache.org/viewvc?rev=597693&view=rev Log: [SUREFIRE-55] Argline inappropriately split on spaces. I can't reproduce any problem with the old behavior (since we're just going to glue all of the arguments back together again when we pass them as a giant quoted argument to cmd), but doing this the right way is easy, and doesn't seem to hurt anything either.
Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/pom.xml maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/src/test/java/TestSurefireArgLine.java Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java?rev=597693&r1=597692&r2=597693&view=diff ============================================================================== --- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java (original) +++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java Fri Nov 23 08:02:56 2007 @@ -154,7 +154,7 @@ if ( argLine != null ) { - cli.addArguments( StringUtils.split( argLine, " " ) ); + cli.createArg().setLine( argLine ); } if ( environmentVariables != null ) @@ -173,7 +173,7 @@ if ( System.getProperty( "maven.surefire.debug" ) != null ) { - cli.createArgument().setLine( + cli.createArg().setLine( "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" ); } @@ -197,17 +197,17 @@ throw new SurefireBooterForkException( "Error creating archive", e ); } - cli.createArgument().setValue( "-jar" ); + cli.createArg().setValue( "-jar" ); - cli.createArgument().setValue( jarFile.getAbsolutePath() ); + cli.createArg().setValue( jarFile.getAbsolutePath() ); } else { - cli.createArgument().setValue( "-classpath" ); + cli.createArg().setValue( "-classpath" ); - cli.createArgument().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) ); + cli.createArg().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) ); - cli.createArgument().setValue( SurefireBooter.class.getName() ); + cli.createArg().setValue( SurefireBooter.class.getName() ); } cli.setWorkingDirectory( workingDirectory.getAbsolutePath() ); Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java?rev=597693&r1=597692&r2=597693&view=diff ============================================================================== --- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java (original) +++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java Fri Nov 23 08:02:56 2007 @@ -596,11 +596,11 @@ Commandline cli = forkConfiguration.createCommandLine( bootClasspath, useSystemClassLoader() ); - cli.createArgument().setFile( surefireProperties ); + cli.createArg().setFile( surefireProperties ); if ( systemProperties != null ) { - cli.createArgument().setFile( systemProperties ); + cli.createArg().setFile( systemProperties ); } Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/pom.xml URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/pom.xml?rev=597693&r1=597692&r2=597693&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/pom.xml (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/pom.xml Fri Nov 23 08:02:56 2007 @@ -44,7 +44,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <argLine>"-Djava.library.path=foo foo/foo/bar/1.0"</argLine> + <argLine>-Dfoo.property="foo foo/foo/bar/1.0" -Dbar.property="bar bar/foo/bar/2.0"</argLine> </configuration> </plugin> </plugins> Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/src/test/java/TestSurefireArgLine.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/src/test/java/TestSurefireArgLine.java?rev=597693&r1=597692&r2=597693&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/src/test/java/TestSurefireArgLine.java (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/argLine-parameter/src/test/java/TestSurefireArgLine.java Fri Nov 23 08:02:56 2007 @@ -6,10 +6,14 @@ public void testArgLine() { - String javaLibraryPath = System.getProperty( "java.library.path" ); - assertEquals( "incorrect java.library.path; " + + String fooProperty = System.getProperty( "foo.property" ); + assertEquals( "incorrect foo.property; " + "Surefire should have passed this in correctly", - "foo foo/foo/bar/1.0", javaLibraryPath ); + "foo foo/foo/bar/1.0", fooProperty ); + String barProperty = System.getProperty( "bar.property" ); + assertEquals( "incorrect bar.property; " + + "Surefire should have passed this in correctly", + "bar bar/foo/bar/2.0", barProperty ); } }