This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: File.toUrl, is this a bug? the problem
- From: Marilen Corciovei <marilen dot corciovei at nemesisit dot ro>
- To: tromey at redhat dot com
- Cc: gcj <java at gcc dot gnu dot org>
- Date: 14 Apr 2003 05:09:27 +0300
- Subject: Re: File.toUrl, is this a bug? the problem
- Organization:
- References: <1050189230.416.8.camel@prophet> <87istidppv.fsf@fleche.redhat.com>
Hi,
I am using a version from thisiscool.com (gcc33-20030324).
I took the cvs version and I think the problem is as follows:
- the 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
A simple example to generate this error:
File file = new File(args[0]);
URL url;
if (file.exists()) {
url = file.toURL();
}else{
url = new URL(args[0]);
}
System.out.println("url = " + url);
String fileName = url.getFile();
System.out.println("fileName = " + fileName);
FileInputStream f = new FileInputStream(fileName);
Len
P.S. I am sorry I can not help more but windows is not my native or
favorite platform.
On Mon, 2003-04-14 at 00:58, Tom Tromey wrote:
> >>>>> "Marilen" == Marilen Corciovei <marilen dot corciovei at nemesisit dot ro> writes:
>
> Marilen> While running my application which I finnaly compiled and
> Marilen> works 50-60% I found a problem which can be easy replicated
> Marilen> using the following piece of code:
>
> What version of gcj are you using?
>
> Thanks for the code. Unfortunately I don't have a Windows build, so I
> won't be able to look at this. Maybe you could?
>
> Marilen> If args[0] is a local file I get the following error:
>
> Marilen> java.io.FileNotFoundException: \c:\thisiscool-gcc\examples\reflect\list:
>
> This is a bug in the URL parsing, or a bug when creating the URL?
> It would be useful if you could change your program to print the URL
> you get. That might give some useful info.
>
> Tom
Marilen Aretius Corciovei
Technical Manager, Nemesis IT
marilen dot corciovei at nemesisit dot ro
+40-721253015