From 61c308cdbb39e01d06d83499b8c348e95bb04d52 Mon Sep 17 00:00:00 2001 From: zyro Date: Sat, 31 May 2014 10:36:20 +0200 Subject: [PATCH] fixes #64: support spaces in CodeSource URLs --- .../loaded/agent/SpringLoadedPreProcessor.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java b/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java index 2f64011..be2618d 100644 --- a/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java +++ b/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java @@ -19,7 +19,6 @@ import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.URI; -import java.net.URISyntaxException; import java.security.CodeSource; import java.security.ProtectionDomain; import java.util.ArrayList; @@ -535,8 +534,8 @@ public class SpringLoadedPreProcessor implements Constants { File file = null; URI uri = null; try { - uri = codeSource.getLocation().toURI(); - file = new File(uri); + file = new File(codeSource.getLocation().getFile()); + uri = file.toURI(); } catch (IllegalArgumentException iae) { boolean recovered = false; if (iae.toString().indexOf("URI is not hierarchical")!=-1) { @@ -584,7 +583,7 @@ public class SpringLoadedPreProcessor implements Constants { log.info("Watched location for changes to " + slashedClassName + " is " + watchPath); } } - } catch (URISyntaxException e) { + } catch (Exception e) { throw new IllegalStateException("Unexpected problem processing URI ", e); } }