diff --git a/src/main/org/apache/tools/ant/launch/Locator.java b/src/main/org/apache/tools/ant/launch/Locator.java index 59f67872e..ea30b1be6 100644 --- a/src/main/org/apache/tools/ant/launch/Locator.java +++ b/src/main/org/apache/tools/ant/launch/Locator.java @@ -405,7 +405,7 @@ public final class Locator { @Deprecated public static URL fileToURL(File file) throws MalformedURLException { - return new URL(file.getAbsoluteFile().toURI().toASCIIString()); + return new URL(file.toURI().toASCIIString()); } /** diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index b3e23368a..caaa82b61 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -138,7 +138,7 @@ public class FileUtils { * formed. */ public URL getFileURL(File file) throws MalformedURLException { - return new URL(toURI(file.getAbsolutePath())); + return new URL(file.toURI().toASCIIString()); } /** @@ -1209,7 +1209,7 @@ public class FileUtils { * @since Ant 1.6 */ public String toURI(String path) { - return new File(path).getAbsoluteFile().toURI().toASCIIString(); + return new File(path).toURI().toASCIIString(); } /**