Hi Matt, another point: URL.getPath() has been introduced in jdk 1.3 but maybe you can use URL.getFile() instead. Regards, Rainer
> -----Original Message----- > From: Matt Benson [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 03, 2004 9:32 PM > To: Ant Developers List > Subject: Re: cvs commit: > ant/src/main/org/apache/tools/ant/launch Locator.java > > > Good point. I'll alter that. :) > > -Matt > > --- Martijn Kruithof <[EMAIL PROTECTED]> > wrote: > > [EMAIL PROTECTED] wrote: > > > > > > > > 1.12 +12 -7 > > > ant/src/main/org/apache/tools/ant/launch/Locator.java > > > > > > Index: Locator.java > > > > > > =================================================================== > > > RCS file: > > > /home/cvs/ant/src/main/org/apache/tools/ant/launch/Locator.java,v > > > retrieving revision 1.11 > > > retrieving revision 1.12 > > > diff -u -r1.11 -r1.12 > > > --- Locator.java 9 Mar 2004 16:48:03 -0000 1.11 > > > +++ Locator.java 2 Apr 2004 20:20:43 -0000 1.12 > > > @@ -101,13 +101,18 @@ > > > * @since Ant 1.6 > > > */ > > > public static String fromURI(String uri) { > > > - if (!uri.startsWith("file:")) { > > > - throw new > > IllegalArgumentException("Can only handle file: > > URIs"); > > > - } > > > - if (uri.startsWith("file://")) { > > > - uri = uri.substring(7); > > > - } else { > > > - uri = uri.substring(5); > > > + try { > > > + URL url = new URL(uri); > > > + if > > (!("file".equals(url.getProtocol()))) { > > > + throw new > > IllegalArgumentException("Can only handle file: > > URIs"); > > > + } > > > + StringBuffer buf = new > > StringBuffer(url.getHost()); > > > + if (buf.length() > 0) { > > > + buf.insert(0, "//"); > > > + } > > > + buf.append(url.getPath()); > > > + uri = buf.toString(); > > > + } catch (MalformedURLException > > emYouEarlEx) { > > > } > > > > > > uri = uri.replace('/', > > File.separatorChar); > > > > > > > > > > > This is funny, If the URL isn't a file URL we throw > > an > > IllegalArgumentException, but if the URL isn't a > > valid URL at all we > > just continue? (Without removing the file:(//) which > > could have been in > > front, which would have been removed before?) > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Small Business $15K Web Design Giveaway > http://promotions.yahoo.com/design_giveaway/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]