File.toUrl, is this a bug? the problem

Marilen Corciovei marilen.corciovei@nemesisit.ro
Mon Apr 14 03:24:00 GMT 2003


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.corciovei@nemesisit.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.corciovei@nemesisit.ro
+40-721253015


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /