geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r634087 - in /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder: ClassFinder.java ResourceFinder.java
Date Thu, 06 Mar 2008 00:05:25 GMT
Author: dblevins
Date: Wed Mar  5 16:05:23 2008
New Revision: 634087

URL: http://svn.apache.org/viewvc?rev=634087&view=rev
Log:
properly decode URLs

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.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/ClassFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java?rev=634087&r1=634086&r2=634087&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
Wed Mar  5 16:05:23 2008
@@ -32,6 +32,7 @@
 import java.lang.reflect.AnnotatedElement;
 import java.net.URL;
 import java.net.JarURLConnection;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -361,7 +362,7 @@
 
     private List<String> file(URL location) {
         List<String> classNames = new ArrayList<String>();
-        File dir = new File(location.getPath());
+        File dir = new File(URLDecoder.decode(location.getPath()));
         if (dir.getName().equals("META-INF")) {
             dir = dir.getParentFile(); // Scrape "META-INF" off
         }

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=634087&r1=634086&r2=634087&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
Wed Mar  5 16:05:23 2008
@@ -25,6 +25,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -853,7 +854,7 @@
     }
 
     private static void readDirectoryEntries(URL location, Map<String, URL> resources)
throws MalformedURLException {
-        File dir = new File(location.getPath());
+        File dir = new File(URLDecoder.decode(location.getPath()));
         if (dir.isDirectory()) {
             File[] files = dir.listFiles();
             for (File file : files) {
@@ -1025,7 +1026,9 @@
                     buf.append(fixedResName);
                     String filename = buf.toString();
                     File file = new File(filename);
-                    if (file.exists()) {
+                    File file2 = new File(URLDecoder.decode(filename));
+
+                    if (file.exists() || file2.exists()) {
                         return targetURL(currentUrl, fixedResName);
                     }
                 } else {



Mime
View raw message