This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libgcj/10403: FileInputStream(File.toUrl().getFile()) does not work
- From: marilen dot corciovei at nemesisit dot ro
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Apr 2003 19:34:54 -0000
- Subject: libgcj/10403: FileInputStream(File.toUrl().getFile()) does not work
- Reply-to: marilen dot corciovei at nemesisit dot ro
>Number: 10403
>Category: libgcj
>Synopsis: FileInputStream(File.toUrl().getFile()) does not work
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 14 19:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Marilen Corciovei
>Release: 3.3 cvs
>Organization:
>Environment:
windows 2000, mingw
>Description:
The following code throws a FileNotFoundException even if the file is valid.
File file = new File(args[0]);
URL url;
if (file.exists()) {
url = file.toURL();
}else{
url = new URL(args[0]);
}
String fileName = url.getFile();
FileInputStream f = new FileInputStream(fileName);
File.toUrl() returns something like:
"file:/c:/thisiscool-gcc/examples/reflect/src/list" (java.io.File#779)
which is parsed at java.net.URL#331 after that the URL.getFile will return "/c:/thisiscool-gcc/examples/reflect/src/list". From this point all the problems begin.
- the exception is thrown probably in the native FileDescriptor: natFileDescriptorWin32.cc#116 implementations
The problem is probably in the FileInputStream implementation
>How-To-Repeat:
Compile the code using gcj --Main=main -o test.exe Main.java and run ./test.exe
>Fix:
The problem is probably in the FileInputStream implementation since the URL.toFile returns what it is expected.
>Release-Note:
>Audit-Trail:
>Unformatted: