[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix for java/net/URLClassLoader
From: |
Archie Cobbs |
Subject: |
Fix for java/net/URLClassLoader |
Date: |
Sat, 09 Jul 2005 15:14:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 |
This patch (checked in) fixes two Mauve tests and removes some
obsolete code.
2005-07-09 Archie Cobbs <address@hidden>
* 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();
}
- Fix for java/net/URLClassLoader,
Archie Cobbs <=