This patch (checked in) fixes two Mauve tests and removes some
obsolete code.

    2005-07-09  Archie Cobbs  <[EMAIL PROTECTED]>

       * java/net/URLClassLoader.java: disallow directories as resources

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com
--- java/net/URLClassLoader.java.orig   2005-07-09 15:07:42.000000000 -0500
+++ java/net/URLClassLoader.java        2005-07-09 15:06:06.000000000 -0500
@@ -536,7 +536,7 @@
     Resource getResource(String name)
     {
       File file = new File(dir, name);
-      if (file.exists())
+      if (file.exists() && !file.isDirectory())
         return new FileResource(this, name, file);
       return null;
     }
@@ -554,36 +554,11 @@
 
     InputStream getInputStream() throws IOException
     {
-      // Delegate to the URL content handler mechanism to retrieve an
-      // HTML representation of the directory listing if a directory
-      if (file.isDirectory())
-        {
-          URL url = getURL();
-          return url.openStream();
-        }
-      // Otherwise simply return a FileInputStream
       return new FileInputStream(file);
     }
 
     public int getLength()
     {
-      // Delegate to the URL content handler mechanism to retrieve the
-      // length of the HTML representation of the directory listing if
-      // a directory, or -1 if an exception occurs opening the directory.
-      if (file.isDirectory())
-        {
-          URL url = getURL();
-          try
-            {
-              URLConnection connection = url.openConnection();
-              return connection.getContentLength();
-            }
-          catch (IOException e)
-            {
-              return -1;
-            }
-        }
-      // Otherwise simply return the file length
       return (int) file.length();
     }
 
_______________________________________________
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to