aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2005-09-16 22:57:10 +0000
committerAnthony Green <green@gcc.gnu.org>2005-09-16 22:57:10 +0000
commitba80a8b2647cbb1c15e6fa4489df9fc48f480136 (patch)
tree00b1b313037ac4a3b8bec3bb964ab806989a73b3 /libjava/java
parent10d6edf84c350e224ed8b917f1d3f0087b7e5277 (diff)
downloadgcc-ba80a8b2647cbb1c15e6fa4489df9fc48f480136.zip
gcc-ba80a8b2647cbb1c15e6fa4489df9fc48f480136.tar.gz
gcc-ba80a8b2647cbb1c15e6fa4489df9fc48f480136.tar.bz2
re PR classpath/20198 (java.security.CodeSource.getLocation output is different than expected)
PR libgcj/20198 * java/net/URLClassLoader.java (FileURLLoader.getResource): File resources should all have canonicalized names. From-SVN: r104360
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/net/URLClassLoader.java13
1 files changed, 10 insertions, 3 deletions
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;
}
}