ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject Re: [PATCH] Fixes for <xmlvalidate>
Date Wed, 09 May 2001 14:09:40 GMT

----- Original Message -----
From: "Jesse Glick" <Jesse.Glick@netbeans.com>
To: <ant-dev@jakarta.apache.org>
Sent: Thursday, May 10, 2001 12:42 AM
Subject: Re: [PATCH] Fixes for <xmlvalidate>


> Stefan Bodewig wrote:
> > This patch uses File.toURL(), which makes it dependent on JDK 1.2+,
> > followed by URL.toExternalForm().  The current task can be used in JDK
> > 1.1.
> >
> > Any reason we should not use something like this (taken from
> > ProjectHelper)
> >
> > String uri = "file:" + buildFile.getAbsolutePath().replace('\\', '/');
> > for (int index = uri.indexOf('#'); index != -1; index =
uri.indexOf('#')) {
> >     uri = uri.substring(0, index) + "%23" + uri.substring(index+1);
> > }
>
> Fine with me... note however the Javadoc for File.toURL() in 1.2
explicitly
> admonishes that the exact format is system-dependent, so while the code
above
> ought to work, it is permissible for some JDK to reject the resulting
URL.
> Consider a platform with unusual filename syntax, such as MacOS or
OpenVMS.
> But presumably if the build script can be parsed at all, this code will
work
> too.
>

I don't think it will be a problem. I expect the admonishment is there
because the filename format is system dependent. For example on a window's
system you end up with the C:/blah/blah in the file component of the URL.
There is a bug in the bug database
http://developer.java.sun.com/developer/bugParade/bugs/4273532.html, which
is reported as fixed with the following comment

File.toURL now uses code in sun.net.www.ParseUtil to escape reserved and
excluded characters in the path. The path is UTF-8 encoded as well.
xxxxx@xxxxx 2000-02-24

Conor




Mime
View raw message