Skip to content

Commit

Permalink
Merge pull request #72 from rshivane/master
Browse files Browse the repository at this point in the history
Added jinsight.jar location to ContextualModuleLoader 
Fixes #71
  • Loading branch information
rshivane authored Oct 6, 2020
2 parents a9e076f + b5e342c commit 33cefb6
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,35 +106,28 @@ private static URL[] getSystemClassPath() {
}

ArrayList<URL> path = new ArrayList<>();
int off;
if (cp != null) {
off = 0;

int off = 0;
int next;
do {
next = cp.indexOf(File.pathSeparator, off);
String element = next == -1 ? cp.substring(off) : cp.substring(off, next);
if (!element.isEmpty()) {
URL url = toFileURL(element);
if (url != null) {
try {
URL url = (new File(element)).getCanonicalFile().toURI().toURL();
path.add(url);
} catch (IOException ignored) {
//Ignore invalid urls
}
}

off = next + 1;
} while (next != -1);
}
path.add(ContextualModuleLoader.class.getProtectionDomain().getCodeSource().getLocation());
return path.toArray(new URL[0]);
}

private static URL toFileURL(String path) {
try {
return (new File(path)).getCanonicalFile().toURI().toURL();
} catch (IOException e) {
return null;
}
}

public Class<?> addClass(String name, byte[] bytes)
throws ClassFormatError {
Class<?> cl = defineClass(name, bytes, 0, bytes.length);
Expand Down

0 comments on commit 33cefb6

Please sign in to comment.