]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR classpath/20198 (java.security.CodeSource.getLocation output is different than...
authorAnthony Green <green@redhat.com>
Fri, 16 Sep 2005 22:57:10 +0000 (22:57 +0000)
committerAnthony Green <green@gcc.gnu.org>
Fri, 16 Sep 2005 22:57:10 +0000 (22:57 +0000)
        PR libgcj/20198
        * java/net/URLClassLoader.java (FileURLLoader.getResource): File
        resources should all have canonicalized names.

From-SVN: r104360

libjava/ChangeLog
libjava/java/net/URLClassLoader.java

index 3520d8c3c0812aec1b32ebd7285bb065bf4e3319..7777f3a6bb900d08d63b34785aa4bdb81c160fe3 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-16  Anthony Green  <green@redhat.com>
+
+       PR libgcj/20198
+       * java/net/URLClassLoader.java (FileURLLoader.getResource): File
+       resources should all have canonicalized names.
+
 2005-09-15  Tom Tromey  <tromey@redhat.com>
 
        PR libgcj/16032:
index 5d48c02b2962d8533f8f27d84b12bf2725f9acd0..2a6f87c4093bf8c0b8bed67ac3fcc5729c8463c3 100644 (file)
@@ -610,9 +610,16 @@ public class URLClassLoader extends SecureClassLoader
     /** get resource with the name "name" in the file url */
     Resource getResource(String name)
     {
-      File file = new File(dir, name);
-      if (file.exists())
-        return new FileResource(this, name, file);
+      try 
+       {
+         File file = new File(dir, name).getCanonicalFile();
+         if (file.exists() && !file.isDirectory())
+           return new FileResource(this, file.path(), file);
+       }
+      catch (IOException e)
+       {
+         // Fall through...
+       }
       return null;
     }
   }