Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2018-11-14 16:37:00 -0500
committerThomas Watson2018-11-14 16:37:36 -0500
commitb6937a1091da056b50164cb90f3753d246386c36 (patch)
tree8450b480f876877e87ee5c1e186384b10e394e26
parent4dd656679b7a358bdbc18d11caccbdf7efe0f1bd (diff)
downloadrt.equinox.framework-b6937a1091da056b50164cb90f3753d246386c36.tar.gz
rt.equinox.framework-b6937a1091da056b50164cb90f3753d246386c36.tar.xz
rt.equinox.framework-b6937a1091da056b50164cb90f3753d246386c36.zip
Bug 541175 - Avoid generating NullPackageSource objects when there areY20181114-2200I20181115-1800I20181115-0200I20181114-1800
no require bundle wires Change-Id: I4bd19c1bee2fdc9cac4f50a77a2a1a8a4a62f4a4 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/KeyedHashSet.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java3
2 files changed, 12 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/KeyedHashSet.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/KeyedHashSet.java
index a37f2d9a2..0db7e07b7 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/KeyedHashSet.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/KeyedHashSet.java
@@ -183,8 +183,16 @@ public class KeyedHashSet {
* all its current values.
*/
protected void expand() {
+ if (elements.length == Integer.MAX_VALUE) {
+ throw new OutOfMemoryError();
+ }
KeyedElement[] oldElements = elements;
- elements = new KeyedElement[elements.length * 2];
+ int newSize = elements.length * 2;
+ if (newSize < 0) {
+ // overflowed; set to max
+ newSize = Integer.MAX_VALUE;
+ }
+ elements = new KeyedElement[newSize];
int maxArrayIndex = elements.length - 1;
for (int i = 0; i < oldElements.length; i++) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
index 461dc3101..f86899473 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
@@ -1191,6 +1191,9 @@ public class BundleLoader extends ModuleLoader {
}
private PackageSource findRequiredSource(String pkgName, Collection<BundleLoader> visited) {
+ if (requiredBundleWires.isEmpty()) {
+ return null;
+ }
synchronized (requiredSources) {
PackageSource result = (PackageSource) requiredSources.getByKey(pkgName);
if (result != null)

Back to the top