You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2012/08/22 14:31:57 UTC

svn commit: r1376014 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Author: hibou
Date: Wed Aug 22 12:31:57 2012
New Revision: 1376014

URL: http://svn.apache.org/viewvc?rev=1376014&view=rev
Log:
To make an URL of a file, use FileUtils.getFileURL, which seems to do the job correctly

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?rev=1376014&r1=1376013&r2=1376014&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Wed Aug 22 12:31:57 2012
@@ -27,6 +27,8 @@ import java.text.CharacterIterator;
 import java.text.StringCharacterIterator;
 import java.util.Locale;
 
+import org.apache.tools.ant.util.FileUtils;
+
 // CheckStyle:LineLengthCheck OFF - urls are long!
 /**
  * The Locator is a utility class which is used to find certain items
@@ -401,11 +403,7 @@ public final class Locator {
      */
     public static URL fileToURL(File file)
         throws MalformedURLException {
-        try {
-            return new URL(encodeURI(file.toURL().toString()));
-        } catch (UnsupportedEncodingException ex) {
-            throw new MalformedURLException(ex.toString());
-        }
+        return FileUtils.getFileUtils().getFileURL(file);
     }
 
     /**