Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for issue #1248 #1477

Merged
merged 1 commit into from Feb 4, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Expand Up @@ -1351,7 +1351,7 @@ protected LoadServiceResource tryResourceFromJarURLWithLoadPath(String namePlusS
if (current.getJarEntry(canonicalEntry) != null) {
try {
URI resourceUri = new URI("jar", "file:" + jarFileName + "!/" + canonicalEntry, null);
foundResource = new LoadServiceResource(resourceUri.toURL(), resourceUri.toString());
foundResource = new LoadServiceResource(resourceUri.toURL(), resourceUri.getSchemeSpecificPart());
debugLogFound(foundResource);
} catch (URISyntaxException e) {
throw runtime.newIOError(e.getMessage());
Expand Down Expand Up @@ -1392,13 +1392,21 @@ protected boolean loadPathLooksLikeClasspathURL(String loadPathEntry) {
}

private String[] splitJarUrl(String loadPathEntry) {
int idx = loadPathEntry.indexOf("!");
String unescaped = loadPathEntry;

try {
unescaped = new URI(loadPathEntry).getSchemeSpecificPart();
} catch (URISyntaxException e) {
// Fall back to using the original string
}

int idx = unescaped.indexOf("!");
if (idx == -1) {
return new String[]{loadPathEntry, ""};
return new String[]{unescaped, ""};
}

String filename = loadPathEntry.substring(0, idx);
String entry = idx + 2 < loadPathEntry.length() ? loadPathEntry.substring(idx + 2) : "";
String filename = unescaped.substring(0, idx);
String entry = idx + 2 < unescaped.length() ? unescaped.substring(idx + 2) : "";

if(filename.startsWith("jar:")) {
filename = filename.substring(4);
Expand Down