Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-02-04 11:37:18 -0500
committerThomas Watson2008-02-04 11:37:18 -0500
commit62c3ab9dd5ea990ccc53190756a4ce701a0475e3 (patch)
tree4c8bf767666f887c2f31511f1fc6c90c3c374ce3 /bundles/org.eclipse.osgi/resolver
parent9bd1f4db38340d418cee5fb842b27e4c2a1bf34c (diff)
downloadrt.equinox.framework-62c3ab9dd5ea990ccc53190756a4ce701a0475e3.tar.gz
rt.equinox.framework-62c3ab9dd5ea990ccc53190756a4ce701a0475e3.tar.xz
rt.equinox.framework-62c3ab9dd5ea990ccc53190756a4ce701a0475e3.zip
Bug 217150 org.eclipse.osgi.internal.resolver.BundleDescriptionImpl.getFragments throws a NPE if there is no containing statev20080204
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index 548d98c3a..35383922e 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -134,7 +134,10 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
public BundleDescription[] getFragments() {
if (host != null)
return EMPTY_BUNDLEDESCS;
- return containingState == null ? EMPTY_BUNDLEDESCS : containingState.getFragments(this);
+ StateImpl currentState = (StateImpl) getContainingState();
+ if (currentState == null)
+ throw new IllegalStateException("BundleDescription does not belong to a state."); //$NON-NLS-1$
+ return currentState.getFragments(this);
}
public HostSpecification getHost() {
@@ -464,7 +467,10 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
private void fullyLoad() {
if ((stateBits & LAZY_LOADED) == 0)
return;
- StateReader reader = containingState.getReader();
+ StateImpl currentState = (StateImpl) getContainingState();
+ StateReader reader = currentState == null ? null : currentState.getReader();
+ if (reader == null)
+ throw new IllegalStateException("No valid reader for the bundle description"); //$NON-NLS-1$
synchronized (reader) {
if (isFullyLoaded()) {
reader.setAccessedFlag(true); // set reader accessed flag
@@ -500,6 +506,9 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
void unload() {
if ((stateBits & LAZY_LOADED) == 0)
return;
+ StateImpl currentState = (StateImpl) getContainingState();
+ if (currentState == null)
+ throw new IllegalStateException("BundleDescription does not belong to a State."); //$NON-NLS-1$
if (!isFullyLoaded())
return;
setFullyLoaded(false);
@@ -508,7 +517,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
if (tempData == null || tempData.selectedExports == null)
return;
for (int i = 0; i < tempData.selectedExports.length; i++)
- containingState.getReader().objectTable.remove(new Integer(((ExportPackageDescriptionImpl) tempData.selectedExports[i]).getTableIndex()));
+ currentState.getReader().objectTable.remove(new Integer(((ExportPackageDescriptionImpl) tempData.selectedExports[i]).getTableIndex()));
}
void setDynamicStamps(HashMap dynamicStamps) {

Back to the top