stevel 2005/08/23 02:43:27 Modified: src/main/org/apache/tools/ant/taskdefs MakeUrl.java Log: move to FileUtils.toURI Revision Changes Path 1.2 +10 -10 ant/src/main/org/apache/tools/ant/taskdefs/MakeUrl.java Index: MakeUrl.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MakeUrl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MakeUrl.java 22 Aug 2005 16:49:44 -0000 1.1 +++ MakeUrl.java 23 Aug 2005 09:43:27 -0000 1.2 @@ -21,11 +21,11 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import java.io.File; -import java.net.MalformedURLException; import java.util.List; import java.util.LinkedList; import java.util.ListIterator; @@ -37,7 +37,7 @@ * nested filesets are supported; if present, these are turned into the * url with the given separator between them (default = " "). * - * @ant.task category="core" name="tourl" + * @ant.task category="core" name="makeurl" */ public class MakeUrl extends Task { @@ -263,6 +263,10 @@ getProject().setNewProperty(property, url); } + /** + * check for errors + * @throws BuildException if we are not configured right + */ private void validate() { //validation if (property == null) { @@ -278,17 +282,13 @@ * * @param fileToConvert * @return the file converted to a URL - * @throws BuildException if the file would not convert */ private String toURL(File fileToConvert) { String url; - try { - //create the URL - url = fileToConvert.toURI().toURL().toExternalForm(); - //set the property - } catch (MalformedURLException e) { - throw new BuildException("Could not convert " + fileToConvert, e); - } + //create the URL + //ant equivalent of fileToConvert.toURI().toURL().toExternalForm(); + url = FileUtils.getFileUtils().toURI(fileToConvert.getAbsolutePath()); + return url; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]