URLClassLoader.java (Resource.getCodeSource): Fix check certs == null.
authorMark Wielaard <mark@klomp.org>
Thu, 2 Jan 2003 09:34:34 +0000 (09:34 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Thu, 2 Jan 2003 09:34:34 +0000 (09:34 +0000)
        * java/net/URLClassLoader.java (Resource.getCodeSource):
        Fix check certs == null.
        (getCanonicalFileURL): Removed method.
        (JarURLLoader): Don't call removed method.
        (FileURLLoader): Likewise.
        (FileURLLoader.getResource): Don't canonicalize file name.

Co-Authored-By: Jeroen Frijters <jeroen@sumatra.nl>
From-SVN: r60780

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

index 1d3d4bd603043926088c01c212e3ffd9c9e7653e..ebc9a32fd7c76aab2224ac3e69ad6c49024ec5d7 100644 (file)
@@ -1,3 +1,13 @@
+2003-01-02  Mark Wielaard  <mark@klomp.org>
+           Jeroen Frijters  <jeroen@sumatra.nl>
+
+       * java/net/URLClassLoader.java (Resource.getCodeSource):
+       Fix check certs == null.
+       (getCanonicalFileURL): Removed method.
+       (JarURLLoader): Don't call removed method.
+       (FileURLLoader): Likewise.
+       (FileURLLoader.getResource): Don't canonicalize file name.
+
 2003-01-01  Tom Tromey  <tromey@redhat.com>
 
        * Makefile.in: Rebuilt.
index c6dc4b1d44dca512e3e767828158294b8c185edc..d7fc77f8ab433152b2ed05d8f8a8d4ec3c79f776 100644 (file)
@@ -238,7 +238,7 @@ public class URLClassLoader extends SecureClassLoader
     CodeSource getCodeSource()
     {
       Certificate[] certs = getCertificates();
-      if (certs != null)
+      if (certs == null)
        return loader.noCertCodeSource;
       else
        return new CodeSource(loader.baseURL, certs);
@@ -271,34 +271,18 @@ public class URLClassLoader extends SecureClassLoader
     abstract InputStream getInputStream() throws IOException;
   }
 
-  static URL getCanonicalFileURL(URL url)
-  {
-    if ("file".equals(url.getProtocol()))
-      {
-       try
-         {
-           File f = new File(url.getFile()).getCanonicalFile();
-           url = new URL("file", "", f.toString());
-         }
-       catch (IOException ignore)
-         {
-         }
-      }
-    return url;
-  }
-
   /**
    * A <code>JarURLLoader</code> is a type of <code>URLLoader</code>
    * only loading from jar url.
    */
   final static class JarURLLoader extends URLLoader
   {
-    final JarFile jarfile; // The canonical jar file for this url
+    final JarFile jarfile; // The jar file for this url
     final URL baseJarURL;  // Base jar: url for all resources loaded from jar
 
     public JarURLLoader(URLClassLoader classloader, URL baseURL)
     {
-      super(classloader, getCanonicalFileURL(baseURL));
+      super(classloader, baseURL);
 
       // cache url prefix for all resources in this jar url
       String external = baseURL.toExternalForm();
@@ -481,11 +465,11 @@ public class URLClassLoader extends SecureClassLoader
    */
   final static class FileURLLoader extends URLLoader
   {
-    File dir;   //the canonical file for this file url
+    File dir;   //the file for this file url
 
     FileURLLoader(URLClassLoader classloader, URL url)
     {
-      super(classloader, getCanonicalFileURL(url));
+      super(classloader, url);
       dir = new File(baseURL.getFile());
     }
 
@@ -493,13 +477,6 @@ public class URLClassLoader extends SecureClassLoader
     Resource getResource(String name)
     {
       File file = new File(dir, name);
-      try
-       {
-         file = file.getCanonicalFile();
-       }
-      catch (IOException ignore)
-       {
-       }
       if (file.exists() && !file.isDirectory())
        return new FileResource(this, name, file);
       return null;