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.
-Jesse
--
Jesse Glick <mailto:Jesse.Glick@netbeans.com>
NetBeans, Open APIs <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR
|