Skip to content

Commit

Permalink
Fix StringIndexOutOfBoundsException issue on class load. (thanks @uphy)
Browse files Browse the repository at this point in the history
  • Loading branch information
gab1one committed Sep 6, 2017
1 parent 4f48033 commit 5462b8c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ private void processBundle(final Bundle b, final boolean addRessources) {
// we want to avoid transitive resolving of
// dependencies
final String host = resource.getHost();
if (bundle.getBundleId() == Long.valueOf(host.substring(0, host.indexOf(".")))) {
final int dotIndex = host.indexOf('.');
// when the resource is not in the osgi modules(e.g., nashorn.jar of jre),
// the url doesn't contain '.'.
if (dotIndex <= 0) {
continue;
}
if (bundle.getBundleId() == Long.valueOf(host.substring(0, dotIndex))) {
safeAdd(urls.get(res), resource);
}
}
Expand Down

0 comments on commit 5462b8c

Please sign in to comment.