Regression in GCJ 3.3 in parsing property files

Mark Wielaard mark@klomp.org
Tue Feb 18 22:41:00 GMT 2003


Hi,

On Tue, 2003-02-18 at 19:32, Tom Tromey wrote:
> >>>>> "Ranjit" == Ranjit Mathew <rmathew4lists@hotmail.com> writes:
> 
> Ranjit> The VMClassLoader has only "file:.\" as the base URL for 
> Ranjit> searching the file "build.properties". 
> 
> Where does this string come from?

It comes from VMClassLoader.init() which goes over the "java.class.path"
and adds a File.separator to every directory it finds (which is needed
for URLClassLoader to work correctly since it checks the last character
of the URL file part). This code should probably have used File.toURL()
to create the URLs. But as you already noted File.toURL() seems to not
handle the conversion between File.separator and URL / separators.

> Is it really valid for a file: URL to use `\' as the separator?
> My suspicion is that this sort of URL should always use `/'.
> 
> Note that one known bug in this area is that File.toURL doesn't
> convert the path separator.  I think it should.

I believe that it should since RFC 1738 explicitly says:

        Some URL schemes (such as the ftp, http, and file schemes)
        contain names that can be considered hierarchical; the
        components of the hierarchy are separated by "/".

It then gives an example how to cenvert a VMS file name to this
convention.

But in practice it seems that File.separator is also allowed. So the URL
parse code should also be fixed to handle File.separator when it is not
equal to /.

Some of the non-merged URLStreamHandler protocols from classpath (see
gnu/java/net/protocol) seem to be a bit more tuned to work correctly on
Windows systems.

Cheers,

Mark



More information about the Java mailing list