Skip to content

Commit 39a1f5f

Browse files
committed
Another take at improving jar detection. (#18)
1 parent fa7a9f8 commit 39a1f5f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/matlabcontrol/Configuration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.lang.reflect.Method;
1111
import java.net.URISyntaxException;
1212
import java.net.URL;
13+
import java.net.URLEncoder;
1314
import java.security.CodeSource;
1415
import java.security.ProtectionDomain;
1516

@@ -203,7 +204,9 @@ static String getSupportCodeLocation() throws MatlabConnectionException {
203204
if (url != null) {
204205
//Convert from url to absolute path
205206
try {
206-
File file = new File(url.toURI()).getCanonicalFile();
207+
// make sure that the url is properly encoded
208+
URL encoded = new URL(URLEncoder.encode(url.toString(), "UTF-8"));
209+
File file = new File(encoded.toURI()).getCanonicalFile();
207210
if (file.exists()) {
208211
return file.getAbsolutePath();
209212
} else {

0 commit comments

Comments
 (0)