This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Fwd: Patch: file resources require canonicalized names]


I just checked a comparable patch into FSF HEAD for
libgcj/java/net/URLClassLoader.java, but not
libgcj/classpath/java/net/URLClassLoader.java.  I hope that was the
right thing to do.

Thanks,

AG

--- Begin Message ---
I just checked in the following patch, which was approved by tromey.

2005-09-15  Anthony Green  <green@redhat.com>

	PR libgcj/20198
	* java/net/URLClassLoader.java (FileURLLoader.getResource): File
	resources should all have canonicalized names.


Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.36
diff -u -r1.36 URLClassLoader.java
--- java/net/URLClassLoader.java	9 Sep 2005 21:42:58 -0000	1.36
+++ java/net/URLClassLoader.java	16 Sep 2005 22:48:33 -0000
@@ -535,9 +535,16 @@
     /** get resource with the name "name" in the file url */
     Resource getResource(String name)
     {
-      File file = new File(dir, name);
-      if (file.exists() && !file.isDirectory())
-        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;
     }
   }


--- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]