[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: |
Michael Koch |
Subject: |
[commit-cp] [bugs #10282] URLConnection.connect does not work on directories |
Date: |
Thu, 09 Sep 2004 10:45:12 -0400 |
User-agent: |
Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko) |
This mail is an automated notification from the bugs tracker
of the project: classpath.
/**************************************************************************/
[bugs #10282] Latest Modifications:
Changes by:
Michael Koch <address@hidden>
'Date:
Don 09.09.2004 at 14:40 (GMT)
What | Removed | Added
---------------------------------------------------------------------------
Resolution | None | Fixed
Status | Open | Closed
/**************************************************************************/
[bugs #10282] Full Item Snapshot:
URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=10282>
Project: classpath
Submitted by: Daniel Bonniot
On: Mon 06.09.2004 at 17:19
Category: None
Severity: 5 - Average
Resolution: Fixed
Privacy: Public
Assigned to: None
Status: Closed
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();
}
}
}
Follow-up Comments
------------------
-------------------------------------------------------
Date: Don 09.09.2004 at 12:18 By: Michael Koch <mkoch>
Another patch
File Attachments
-------------------
-------------------------------------------------------
Date: Don 09.09.2004 at 14:08 Name: filedir.diff Size: 2,3KB By: mkoch
And yet another iteration
http://savannah.gnu.org/bugs/download.php?item_id=10282&item_file_id=1651
-------------------------------------------------------
Date: Don 09.09.2004 at 13:17 Name: filedir.diff Size: 2,13KB By: mkoch
Hopefully the last iteration
http://savannah.gnu.org/bugs/download.php?item_id=10282&item_file_id=1650
-------------------------------------------------------
Date: Don 09.09.2004 at 12:18 Name: file-dir.patch Size: 2,09KB By: mkoch
http://savannah.gnu.org/bugs/download.php?item_id=10282&item_file_id=1649
-------------------------------------------------------
Date: Don 09.09.2004 at 10:11 Name: 99_connect Size: 1,97KB By: None
Updated patch with comments
http://savannah.gnu.org/bugs/download.php?item_id=10282&item_file_id=1648
-------------------------------------------------------
Date: Mit 08.09.2004 at 20:42 Name: 99_connect Size: 1,52KB By: None
Proposed patch
http://savannah.gnu.org/bugs/download.php?item_id=10282&item_file_id=1644
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/