aboutsummaryrefslogtreecommitdiff
path: root/src/launch/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-02-03 06:08:51 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-02-03 06:09:41 +0100
commit2856702d77ce32e8253b8cbcc07a6cce1cbf47b7 (patch)
tree613822ba604738de37c2679b2c058c58eae5eb16 /src/launch/lombok
parentd8da2b9438056e945ecc38d98fed413444c847b3 (diff)
downloadlombok-2856702d77ce32e8253b8cbcc07a6cce1cbf47b7.tar.gz
lombok-2856702d77ce32e8253b8cbcc07a6cce1cbf47b7.tar.bz2
lombok-2856702d77ce32e8253b8cbcc07a6cce1cbf47b7.zip
[i777] shadowloader’s ‘find myself’ feature didn’t work if spaces were in the path due to lack of decoding a URL.
Diffstat (limited to 'src/launch/lombok')
-rw-r--r--src/launch/lombok/launch/ShadowClassLoader.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/launch/lombok/launch/ShadowClassLoader.java b/src/launch/lombok/launch/ShadowClassLoader.java
index b883bd71..f8f969ef 100644
--- a/src/launch/lombok/launch/ShadowClassLoader.java
+++ b/src/launch/lombok/launch/ShadowClassLoader.java
@@ -24,9 +24,11 @@ package lombok.launch;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
@@ -114,7 +116,13 @@ class ShadowClassLoader extends ClassLoader {
String sclClassUrl = ShadowClassLoader.class.getResource("ShadowClassLoader.class").toString();
if (!sclClassUrl.endsWith(SELF_NAME)) throw new InternalError("ShadowLoader can't find itself.");
SELF_BASE_LENGTH = sclClassUrl.length() - SELF_NAME.length();
- SELF_BASE = sclClassUrl.substring(0, SELF_BASE_LENGTH);
+ String decoded;
+ try {
+ decoded = URLDecoder.decode(sclClassUrl.substring(0, SELF_BASE_LENGTH), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new InternalError("UTF-8 not available");
+ }
+ SELF_BASE = decoded;
}
if (SELF_BASE.startsWith("jar:file:") && SELF_BASE.endsWith("!/")) SELF_BASE_FILE = new File(SELF_BASE.substring(9, SELF_BASE.length() - 2));