From: green Date: Fri, 16 Sep 2005 22:57:10 +0000 (+0000) Subject: PR libgcj/20198 X-Git-Tag: upstream/4.9.2~58605 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0a3df6c17cc94a25e1090497810e63df311a1b3;p=platform%2Fupstream%2Flinaro-gcc.git PR libgcj/20198 * java/net/URLClassLoader.java (FileURLLoader.getResource): File resources should all have canonicalized names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104360 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3520d8c..7777f3a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2005-09-16 Anthony Green + + PR libgcj/20198 + * java/net/URLClassLoader.java (FileURLLoader.getResource): File + resources should all have canonicalized names. + 2005-09-15 Tom Tromey PR libgcj/16032: diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java index 5d48c02..2a6f87c 100644 --- a/libjava/java/net/URLClassLoader.java +++ b/libjava/java/net/URLClassLoader.java @@ -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; } }