Finding lombok.jar would fail if you had any spaces in the path. Fixed that.

This commit is contained in:
Reinier Zwitserloot committed 2009-06-19 04:32:47 +02:00
1 parent 7f7cdfc3fc
commit b964ec18fc
1 file changed
+4 -1
@@ -9,6 +9,8 @@ import java.lang.instrument.UnmodifiableClassException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.ProtectionDomain;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
@@ -78,7 +80,8 @@ public class EclipsePatcher {
Pattern p = Pattern.compile("^jar:file:([^\\!]+)\\!.*\\.class$");
Matcher m = p.matcher(uri.toString());
if ( !m.matches() ) return ".";
return new File(m.group(1)).getParent();
String rawUri = m.group(1);
return new File(URLDecoder.decode(rawUri, Charset.defaultCharset().name())).getParent();
}
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception {