Skip to content

Commit 5462b8c

Browse files
committed
Fix StringIndexOutOfBoundsException issue on class load. (thanks @uphy)
1 parent 4f48033 commit 5462b8c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

org.knime.scijava.core/src/org/knime/scijava/core/ResourceAwareClassLoader.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ private void processBundle(final Bundle b, final boolean addRessources) {
144144
// we want to avoid transitive resolving of
145145
// dependencies
146146
final String host = resource.getHost();
147-
if (bundle.getBundleId() == Long.valueOf(host.substring(0, host.indexOf(".")))) {
147+
final int dotIndex = host.indexOf('.');
148+
// when the resource is not in the osgi modules(e.g., nashorn.jar of jre),
149+
// the url doesn't contain '.'.
150+
if (dotIndex <= 0) {
151+
continue;
152+
}
153+
if (bundle.getBundleId() == Long.valueOf(host.substring(0, dotIndex))) {
148154
safeAdd(urls.get(res), resource);
149155
}
150156
}

0 commit comments

Comments
 (0)