geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r776705 - in /geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader: DirectoryResourceHandle.java DirectoryResourceLocation.java JarFileUrlConnection.java JarFileUrlStreamHandler.java UrlResourceFinder.java
Date Wed, 20 May 2009 14:09:48 GMT
Author: xuhaihong
Date: Wed May 20 14:09:47 2009
New Revision: 776705

URL: http://svn.apache.org/viewvc?rev=776705&view=rev
Log:
XBEAN-109 org.apache.xbean.classloader.JarFileClassLoader can not handle pathnames with containing
spaces, thanks Ingo Bormann for the patch

Modified:
    geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java
    geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java
    geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java
    geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java
    geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java

Modified: geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java?rev=776705&r1=776704&r2=776705&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceHandle.java
Wed May 20 14:09:47 2009
@@ -39,9 +39,9 @@
     public DirectoryResourceHandle(String name, File file, File codeSource, Manifest manifest)
throws MalformedURLException {
         this.name = name;
         this.file = file;
-        this.codeSource = codeSource.toURL();
+        this.codeSource = codeSource.toURI().toURL();
         this.manifest = manifest;
-        url = file.toURL();
+        url = file.toURI().toURL();
     }
 
     public String getName() {

Modified: geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java?rev=776705&r1=776704&r2=776705&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/DirectoryResourceLocation.java
Wed May 20 14:09:47 2009
@@ -31,7 +31,7 @@
     private Manifest manifest;
 
     public DirectoryResourceLocation(File baseDir) throws MalformedURLException {
-        super(baseDir.toURL());
+        super(baseDir.toURI().toURL());
         this.baseDir = baseDir;
     }
 

Modified: geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java?rev=776705&r1=776704&r2=776705&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlConnection.java
Wed May 20 14:09:47 2009
@@ -63,7 +63,7 @@
         this.url = url;
         this.jarFile = jarFile;
         this.jarEntry = jarEntry;
-        jarFileUrl = new File(jarFile.getName()).toURL();
+        jarFileUrl = new File(jarFile.getName()).toURI().toURL();
     }
 
     public JarFile getJarFile() throws IOException {
@@ -122,7 +122,7 @@
     }
 
     public Permission getPermission() throws IOException {
-        URL jarFileUrl = new File(jarFile.getName()).toURL();
+        URL jarFileUrl = new File(jarFile.getName()).toURI().toURL();
         return jarFileUrl.openConnection().getPermission();
     }
 

Modified: geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java?rev=776705&r1=776704&r2=776705&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/JarFileUrlStreamHandler.java
Wed May 20 14:09:47 2009
@@ -31,7 +31,7 @@
  */
 public class JarFileUrlStreamHandler extends URLStreamHandler {
     public static URL createUrl(JarFile jarFile, JarEntry jarEntry) throws MalformedURLException
{
-        return createUrl(jarFile, jarEntry, new File(jarFile.getName()).toURL());
+        return createUrl(jarFile, jarEntry, new File(jarFile.getName()).toURI().toURL());
     }
 
     public static URL createUrl(JarFile jarFile, JarEntry jarEntry, URL codeSource) throws
MalformedURLException {

Modified: geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java?rev=776705&r1=776704&r2=776705&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/main/java/org/apache/xbean/classloader/UrlResourceFinder.java
Wed May 20 14:09:47 2009
@@ -17,9 +17,10 @@
 package org.apache.xbean.classloader;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -33,8 +34,8 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.jar.Attributes;
-import java.util.jar.Manifest;
 import java.util.jar.JarFile;
+import java.util.jar.Manifest;
 
 /**
  * @version $Rev$ $Date$
@@ -229,7 +230,12 @@
             throw new Error("Only local file jars are supported " + url);
         }
 
-        File file = new File(url.getPath());
+        File file;
+        try {
+            file = new File(url.toURI());
+        } catch (URISyntaxException e) {
+            file = new File(url.getPath());
+        }
         if (!file.exists()) {
             throw new FileNotFoundException(file.getAbsolutePath());
         }



Mime
View raw message