You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2016/12/11 12:42:02 UTC

[3/4] maven-surefire git commit: [SUREFIRE-1312] Classpath containing url special characters with Reflections not working

[SUREFIRE-1312] Classpath containing url special characters with Reflections not working


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/9478990e
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/9478990e
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/9478990e

Branch: refs/heads/master
Commit: 9478990e1e6f5ccb1c25cd3ba92e97a8b57c8228
Parents: fd293d8
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Dec 11 13:32:27 2016 +0100
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Dec 11 13:32:27 2016 +0100

----------------------------------------------------------------------
 .../plugin/surefire/booterclient/ForkConfiguration.java      | 8 ++++----
 .../java/org/apache/maven/surefire/booter/Classpath.java     | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9478990e/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 6d43bd2..988af8f 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
@@ -39,8 +39,6 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
-import static org.apache.maven.surefire.util.internal.UrlUtils.toURL;
-
 /**
  * Configuration for forking tests.
  *
@@ -287,8 +285,10 @@ public class ForkConfiguration
             StringBuilder cp = new StringBuilder();
             for ( String el : classPath )
             {
-                // NOTE: if File points to a directory, this entry MUST end in '/'.
-                cp.append( toURL( new File( el ) ).toExternalForm() )
+                File file1 = new File( el );
+                String pathEnd = file1.isDirectory() ? "/" : "";
+                cp.append( file1.toURI().toASCIIString() )
+                        .append( pathEnd )
                         .append( " " );
             }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9478990e/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
index 13388c5..e7d97c8 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
@@ -162,9 +162,9 @@ public class Classpath implements Iterable<String>
         try
         {
             IsolatedClassLoader classLoader = new IsolatedClassLoader( parent, childDelegation, roleName );
-            for ( URL url : getAsUrlList() )
+            for ( String classPathElement : unmodifiableElements )
             {
-                classLoader.addURL( url );
+                classLoader.addURL( new File( classPathElement ).toURL() );
             }
             if ( parent != null )
             {
@@ -179,7 +179,6 @@ public class Classpath implements Iterable<String>
         }
     }
 
-
     public int hashCode()
     {
         return unmodifiableElements.hashCode();