Re: Fix for java/net/URLClassLoader

2005-07-22 Thread Tom Tromey
 Mark == Mark Wielaard [EMAIL PROTECTED] writes:

Mark I remember we added getting file URLs for directories as
Mark resources because Nice depended on that being
Mark possible. (Indicating that the Mauve test and/or the spec is
Mark wrong here.) It doesn't really make sense to return it as
Mark resource since it is unclear what to return as content. If I
Mark remember correctly some people wanted to return some
Mark HTML-representation of the directory...

This is a good candidate for a big comment in URLClassLoader, plus a
mauve test (also with a big comment) as enforcement.  It is far too
easy to lose track of the various test cases we find out in the
wild...

Tom


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: Fix for java/net/URLClassLoader

2005-07-20 Thread Mark Wielaard
Hi,

On Sat, 2005-07-09 at 15:14 -0500, Archie Cobbs wrote:
 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

I remember we added getting file URLs for directories as resources
because Nice depended on that being possible. (Indicating that the Mauve
test and/or the spec is wrong here.) It doesn't really make sense to
return it as resource since it is unclear what to return as content. If
I remember correctly some people wanted to return some
HTML-representation of the directory...

Daniel, can you remember the discussion? And does Nice still depend on
this?

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Fix for java/net/URLClassLoader

2005-07-09 Thread Archie Cobbs

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.0 -0500
+++ java/net/URLClassLoader.java2005-07-09 15:06:06.0 -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