Browse Source

UNC pathnames did not work for ANT_HOME or -lib locations on Windows.

PR: 27922


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276275 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 21 years ago
parent
commit
9557aed0f0
2 changed files with 15 additions and 7 deletions
  1. +3
    -0
      WHATSNEW
  2. +12
    -7
      src/main/org/apache/tools/ant/launch/Locator.java

+ 3
- 0
WHATSNEW View File

@@ -26,6 +26,9 @@ Fixed bugs:
* 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:
--------------


+ 12
- 7
src/main/org/apache/tools/ant/launch/Locator.java View File

@@ -101,13 +101,18 @@ public final class Locator {
* @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);


Loading…
Cancel
Save