From: aclement Date: Sat, 5 Feb 2011 21:29:00 +0000 (+0000) Subject: 282379 X-Git-Tag: V1_6_11RC1~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5648105b8450a0f0121bd49b65eae21eb135398f;p=aspectj.git 282379 --- diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java index 75951361f..b9f017663 100644 --- a/util/src/org/aspectj/util/FileUtil.java +++ b/util/src/org/aspectj/util/FileUtil.java @@ -34,6 +34,7 @@ import java.io.Reader; import java.io.StringReader; import java.io.Writer; import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -45,7 +46,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; /** - * + * @author Andy Clement + * @author Kris De Volder */ public class FileUtil { /** default parent directory File when a file has a null parent */ @@ -1387,12 +1389,24 @@ public class FileUtil { List ret = new LinkedList(); if (urls != null) { for (int i = 0; i < urls.length; i++) { - ret.add(urls[i].getPath()); + ret.add(toPathString(urls[i])); } } return ret; } + private static String toPathString(URL url) { + try { + return url.toURI().getPath(); + } catch (URISyntaxException e) { + System.err.println("Warning!! Malformed URL may cause problems: "+url); // TODO: Better way to report this? + // In this case it was likely not using properly escaped + // characters so we just use the 'bad' method that doesn't decode + // special chars + return url.getPath(); + } + } + /** * A pipe when run reads from an input stream to an output stream, optionally sleeping between reads. *