Repository: maven-surefire Updated Branches: refs/heads/master eed317207 -> 6fd0a3e7c
[SUREFIRE-1358] Directory in Class-Path in manifest of forked jvm ends with two slashes // Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/6fd0a3e7 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/6fd0a3e7 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/6fd0a3e7 Branch: refs/heads/master Commit: 6fd0a3e7ca7c27234dab67be27efc10875d7a2e6 Parents: eed3172 Author: Tibor17 <tibo...@lycos.com> Authored: Fri Apr 7 23:00:47 2017 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Fri Apr 7 23:00:47 2017 +0200 ---------------------------------------------------------------------- .../booterclient/ForkConfiguration.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6fd0a3e7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java index 7f2c536..c56453a 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java @@ -33,6 +33,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; @@ -280,13 +281,20 @@ public class ForkConfiguration // we can't use StringUtils.join here since we need to add a '/' to // the end of directory entries - otherwise the jvm will ignore them. StringBuilder cp = new StringBuilder(); - for ( String el : classPath ) + for ( Iterator<String> it = classPath.iterator(); it.hasNext(); ) { - File file1 = new File( el ); - String pathEnd = file1.isDirectory() ? "/" : ""; - cp.append( file1.toURI().toASCIIString() ) - .append( pathEnd ) - .append( " " ); + File file1 = new File( it.next() ); + String uri = file1.toURI().toASCIIString(); + cp.append( uri ); + if ( file1.isDirectory() && !uri.endsWith( "/" ) ) + { + cp.append( '/' ); + } + + if ( it.hasNext() ) + { + cp.append( ' ' ); + } } man.getMainAttributes().putValue( "Manifest-Version", "1.0" );