mbenson 2004/04/02 12:20:43
Modified: . WHATSNEW
src/main/org/apache/tools/ant/launch Locator.java
Log:
UNC pathnames did not work for ANT_HOME or -lib locations on Windows.
PR: 27922
Revision Changes Path
1.580 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.579
retrieving revision 1.580
diff -u -r1.579 -r1.580
--- WHATSNEW 1 Apr 2004 19:11:02 -0000 1.579
+++ WHATSNEW 2 Apr 2004 20:20:43 -0000 1.580
@@ -26,6 +26,9 @@
* I/O-intensive processes hung when executed via <exec spawn="true">.
Bugzilla reports 23893/26852.
+* UNC pathnames did not work for ANT_HOME or -lib locations on Windows.
+ Bugzilla report 27922.
+
Other changes:
--------------
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);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]