diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
commit | ce57ab760f69de6db452def7ffbf5b114a2d8694 (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/java/net/URLClassLoader.java | |
parent | 50996fe55769882de3f410896032c887f0ff0d04 (diff) | |
download | gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/net/URLClassLoader.java')
-rw-r--r-- | libjava/classpath/java/net/URLClassLoader.java | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java index 9d0e5041006..9e489db533f 100644 --- a/libjava/classpath/java/net/URLClassLoader.java +++ b/libjava/classpath/java/net/URLClassLoader.java @@ -1,5 +1,5 @@ /* URLClassLoader.java -- ClassLoader that loads classes from one or more URLs - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -292,9 +292,10 @@ public class URLClassLoader extends SecureClassLoader Vector classPath; // The "Class-Path" attribute of this Jar's manifest - public JarURLLoader(URLClassLoader classloader, URL baseURL) + public JarURLLoader(URLClassLoader classloader, URL baseURL, + URL absoluteUrl) { - super(classloader, baseURL); + super(classloader, baseURL, absoluteUrl); // Cache url prefix for all resources in this jar url. String external = baseURL.toExternalForm(); @@ -526,10 +527,10 @@ public class URLClassLoader extends SecureClassLoader { File dir; //the file for this file url - FileURLLoader(URLClassLoader classloader, URL url) + FileURLLoader(URLClassLoader classloader, URL url, URL absoluteUrl) { - super(classloader, url); - dir = new File(baseURL.getFile()); + super(classloader, url, absoluteUrl); + dir = new File(absoluteUrl.getFile()); } /** get resource with the name "name" in the file url */ @@ -723,11 +724,42 @@ public class URLClassLoader extends SecureClassLoader String file = newUrl.getFile(); String protocol = newUrl.getProtocol(); + // If we have a file: URL, we want to make it absolute + // here, before we decide whether it is really a jar. + URL absoluteURL; + if ("file".equals (protocol)) + { + File dir = new File(file); + URL absUrl; + try + { + absoluteURL = dir.getCanonicalFile().toURL(); + } + catch (IOException ignore) + { + try + { + absoluteURL = dir.getAbsoluteFile().toURL(); + } + catch (MalformedURLException _) + { + // This really should not happen. + absoluteURL = newUrl; + } + } + } + else + { + // This doesn't hurt, and it simplifies the logic a + // little. + absoluteURL = newUrl; + } + // Check that it is not a directory if (! (file.endsWith("/") || file.endsWith(File.separator))) - loader = new JarURLLoader(this, newUrl); + loader = new JarURLLoader(this, newUrl, absoluteURL); else if ("file".equals(protocol)) - loader = new FileURLLoader(this, newUrl); + loader = new FileURLLoader(this, newUrl, absoluteURL); else loader = new RemoteURLLoader(this, newUrl); |