summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoraclement <aclement>2011-02-05 21:29:00 +0000
committeraclement <aclement>2011-02-05 21:29:00 +0000
commit5648105b8450a0f0121bd49b65eae21eb135398f (patch)
tree7a768b4fe586066b0360c92829940acd0baadc3c /util
parent3a89b2ebd552af57d1e2b1aa1ad97c38cda771e5 (diff)
downloadaspectj-5648105b8450a0f0121bd49b65eae21eb135398f.tar.gz
aspectj-5648105b8450a0f0121bd49b65eae21eb135398f.zip
282379
Diffstat (limited to 'util')
-rw-r--r--util/src/org/aspectj/util/FileUtil.java18
1 files changed, 16 insertions, 2 deletions
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<String> ret = new LinkedList<String>();
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.
*