Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2007-01-09 09:33:27 -0500
committerThomas Watson2007-01-09 09:33:27 -0500
commitaa28d181121c9c54f4c30f7a0b23cef61dc600a3 (patch)
tree8613030c8e417bd5d2184aad53045f2744fa31b6
parent1884561417adb816aa420eddd328862672c5767b (diff)
downloadrt.equinox.framework-aa28d181121c9c54f4c30f7a0b23cef61dc600a3.tar.gz
rt.equinox.framework-aa28d181121c9c54f4c30f7a0b23cef61dc600a3.tar.xz
rt.equinox.framework-aa28d181121c9c54f4c30f7a0b23cef61dc600a3.zip
Bug 168521 NPE occurs from a currupted state cache.R32x_v20070109
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java7
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java20
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java2
3 files changed, 18 insertions, 11 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java
index 5f491053e..0647a9123 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java
@@ -298,8 +298,11 @@ public class StateManager implements PlatformAdmin, Runnable {
} catch (InterruptedException e) {
return;
}
- if (systemState != null && timeStamp == systemState.getTimeStamp() && !systemState.dynamicCacheChanged())
- systemState.unloadLazyData(expireTime);
+ if (systemState != null)
+ synchronized (systemState) {
+ if (timeStamp == systemState.getTimeStamp() && !systemState.dynamicCacheChanged())
+ systemState.unloadLazyData(expireTime);
+ }
}
}
}
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 ee45d3ce2..1ae157cbb 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
@@ -446,14 +446,17 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
private void fullyLoad() {
if ((stateBits & LAZY_LOADED) == 0)
return;
- if (isFullyLoaded()) {
- containingState.getReader().setAccessedFlag(true); // set reader accessed flag
+ StateReader reader = containingState.getReader();
+ synchronized (reader) {
+ if (isFullyLoaded()) {
+ reader.setAccessedFlag(true); // set reader accessed flag
return;
- }
- try {
- containingState.getReader().fullyLoad(this);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage()); // TODO not sure what to do here!!
+ }
+ try {
+ reader.fullyLoad(this);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage()); // TODO not sure what to do here!!
+ }
}
}
@@ -473,6 +476,9 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
setLazyLoaded(false);
}
+ /*
+ * This method must be called while the state reader for the containing state is locked.
+ */
void unload() {
if ((stateBits & LAZY_LOADED) == 0)
return;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
index eec6e7dc6..21da267d6 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
@@ -121,7 +121,6 @@ class StateWriter {
// the data is written at least once in the non-lazy state data
writeBundleDescription(bundles[i], outState, true);
outState.writeBoolean(state.isResolved());
- state.setDynamicCacheChanged(false);
} finally {
if (outLazy != null) {
try {
@@ -470,7 +469,6 @@ class StateWriter {
public void saveStateDeprecated(StateImpl state, DataOutputStream output) throws IOException {
try {
writeStateDeprecated(state, output);
- state.setDynamicCacheChanged(false);
} finally {
output.close();
}

Back to the top