[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] [bugs #10282] URLConnection.connect does not work on directo
From: |
Daniel Bonniot |
Subject: |
[commit-cp] [bugs #10282] URLConnection.connect does not work on directories |
Date: |
Mon, 06 Sep 2004 13:24:58 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040823 Firefox/0.9.3 |
This mail is an automated notification from the bugs tracker
of the project: classpath.
/**************************************************************************/
[bugs #10282] Full Item Snapshot:
URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=10282>
Project: classpath
Submitted by: Daniel Bonniot
On: Mon 09/06/2004 at 17:19
Category: None
Severity: 5 - Average
Resolution: None
Privacy: Public
Assigned to: None
Status: Open
Platform Version: None
Summary: URLConnection.connect does not work on directories
Original Submission: With an URL (file protocol) representing a local existing
directory, the connect() method fails with java.io.FileNotFoundException:
/tmp/bug/. is a directory
(tested with kaffe, sablevm and gij 3.4 on Debian GNU/Linux).
gij 3.3 does not fail on connect, but it does if you later try to open an
InputStream from that URL.
On all Sun JVMs I could try (1.3, 1.4 and 1.5), connect() works. Furthermore,
it's possible to read from the connection. There is some difference there. 1.3
prints html code (like what you'd get from a web directory listing). 1.4 and
1.5 return one line for each file in the directory. I think it would make the
most sense for classpath to behave the same as 1.4 and 1.5.
Here is a minimal testcase:
public class Bug
{
public static void main(String[] args)
{
try {
java.net.URL dir = new java.io.File(".").toURL();
java.net.URLConnection con = dir.openConnection();
// Connect should work on an existing directory
con.connect();
System.out.println("OK, content:");
// Print the stream associated with the URL
java.io.BufferedReader in = new java.io.BufferedReader
(new java.io.InputStreamReader(con.getInputStream()));
String line;
for (; (line = in.readLine()) != null;)
System.out.println(line);
}
catch(java.io.IOException e) {
e.printStackTrace();
}
}
}
For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=10282>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [commit-cp] [bugs #10282] URLConnection.connect does not work on directories,
Daniel Bonniot <=