diff --git a/src/main/java/hudson/plugins/tfs/model/Server.java b/src/main/java/hudson/plugins/tfs/model/Server.java index 7a35789b4..1f50506ae 100644 --- a/src/main/java/hudson/plugins/tfs/model/Server.java +++ b/src/main/java/hudson/plugins/tfs/model/Server.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.io.Reader; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.security.CodeSource; import java.security.ProtectionDomain; @@ -67,7 +68,15 @@ static synchronized void ensureNativeLibrariesConfigured() { final CodeSource codeSource = protectionDomain.getCodeSource(); // TODO: codeSource could be null; what should we do, then? final URL location = codeSource.getLocation(); - final String stringPathToJar = location.getFile(); + URI locationUri = null; + try { + locationUri = location.toURI(); + } catch (URISyntaxException e) { + // this shouldn't happen + // TODO: consider logging this situation if it ever happens + return; + } + final String stringPathToJar = locationUri.getPath(); final File pathToJar = new File(stringPathToJar); final File pathToLibFolder = pathToJar.getParentFile(); final File pathToNativeFolder = new File(pathToLibFolder, "native");