aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--doc/changelog.markdown1
-rw-r--r--src/launch/lombok/launch/ShadowClassLoader.java10
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 319c8399..f8ea2774 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -6,6 +6,7 @@ Lombok Changelog
* FEATURE: New lombok annotation: `@UtilityClass`, for making utility classes (not instantiable, contains only static 'function' methods). See the [feature documentation](http://projectlombok.org/features/experimental/UtilityClass.html) for more information.
* BUGFIX: The ant `delombok` task was broken starting with v1.16.0. Note that the task def class has been changed; taskdef `lombok.delombok.ant.Tasks$Delombok` instead of the old `lombok.delombok.ant.DelombokTask`. [Issue #775](https://code.google.com/p/projectlombok/issues/detail?id=775).
* BUGFIX: `val` in javac would occasionally fail if used inside inner classes. This is (probably) fixed. [Issue #694](https://code.google.com/p/projectlombok/issues/detail?id=694).
+* BUGFIX: Starting with v1.16.0, lombok would fail to execute as an executable jar if it was in a path was spaced in it. [Issue #777](https://code.google.com/p/projectlombok/issues/detail?id=777).
### v1.16.0 "Candid Duck" (January 26th, 2015)
* BUGFIX: `@ExtensionMethod` was broken in Eclipse using java 8. [Issue #742](https://code.google.com/p/projectlombok/issues/detail?id=742), [Issue #747](https://code.google.com/p/projectlombok/issues/detail?id=747)
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));