geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1484008 - in /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder: ClassLoaders.java ResourceFinder.java
Date Fri, 17 May 2013 21:58:47 GMT
Author: rmannibucau
Date: Fri May 17 21:58:47 2013
New Revision: 1484008

URL: http://svn.apache.org/r1484008
Log:
XBEAN-243 url shouldn't be built manually + under win host is the disk in the url

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java?rev=1484008&r1=1484007&r2=1484008&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java
Fri May 17 21:58:47 2013
@@ -94,11 +94,7 @@ public final class ClassLoaders {
         final Set<URL> urls = new HashSet<URL>();
         for (final String path : cp) {
             try {
-                if (path.endsWith(".jar")) {
-                    urls.add(new URL("jar:file://" + path + "!/"));
-                } else {
-                    urls.add(new URL("file://" + path));
-                }
+                urls.add(new File(path).toURI().toURL()); // don't build the url in plain
String since it is not portable
             } catch (final MalformedURLException e) {
                 // ignore
             }

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java?rev=1484008&r1=1484007&r2=1484008&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
Fri May 17 21:58:47 2013
@@ -32,6 +32,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Vector;
@@ -43,6 +44,7 @@ import java.util.jar.JarFile;
  * @version $Rev$ $Date$
  */
 public class ResourceFinder {
+    private static final boolean WIN = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win");
 
     private final URL[] urls;
     private final String path;
@@ -1019,6 +1021,9 @@ public class ResourceFinder {
                     StringBuffer buf = new StringBuffer(2 + hostLength + baseFile.length()
+ resourceName.length());
 
                     if (hostLength > 0) {
+                        if (WIN && "file".equals(protocol)) {
+                            buf.append(":");
+                        }
                         buf.append("//").append(host);
                     }
                     // baseFile should always ends with '/'



Mime
View raw message