Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2006-01-06 20:20:42 +0000
committerThomas Watson2006-01-06 20:20:42 +0000
commita1b626bfb61bfa5be7426f5e9f1dbba97830cb33 (patch)
tree64bc7b376b16d700f55f5afb24b781af49d91623
parentadc3cec42dd84ceef542e100307e6078d19acbef (diff)
downloadrt.equinox.framework-R3_1_maintenance.tar.gz
rt.equinox.framework-R3_1_maintenance.tar.xz
rt.equinox.framework-R3_1_maintenance.zip
Bug 121148 NPE occurs from a currupted state cache.r31x_v20060106R3_1_2R3_1_maintenance
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java12
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java11
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java13
3 files changed, 25 insertions, 11 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 f3dbcc1ca..5e293a983 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,7 +42,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
private ArrayList dependents;
private LazyData lazyData;
- private long lazyTimeStamp;
public BundleDescriptionImpl() {
//
@@ -383,7 +382,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
void setFullyLoaded(boolean fullyLoaded) {
if (fullyLoaded) {
stateBits |= FULLY_LOADED;
- lazyTimeStamp = System.currentTimeMillis();
} else {
stateBits &= ~FULLY_LOADED;
}
@@ -412,8 +410,10 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
private void fullyLoad() {
if ((stateBits & LAZY_LOADED) == 0)
return;
- if (isFullyLoaded())
+ if (isFullyLoaded()) {
+ containingState.getReader().setAccessedFlag(true); // set reader accessed flag
return;
+ }
try {
containingState.getReader().fullyLoad(this);
} catch (IOException e) {
@@ -436,10 +436,10 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
lazyData.resolvedImports = newImports;
}
- void unload(long currentTime, long expireTime) {
+ void unload() {
if ((stateBits & LAZY_LOADED) == 0)
return;
- if (!isFullyLoaded() || (currentTime - lazyTimeStamp - expireTime) <= 0)
+ if (!isFullyLoaded())
return;
setFullyLoaded(false);
LazyData tempData = lazyData;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index 66b1273f3..cb275ba3b 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -568,12 +568,15 @@ public abstract class StateImpl implements State {
}
public void unloadLazyData(long expireTime) {
- long currentTime = System.currentTimeMillis();
- BundleDescription[] bundles = getBundles();
// make sure no other thread is trying to unload or load
synchronized (reader) {
+ if (reader.getAccessedFlag()) {
+ reader.setAccessedFlag(false); // reset accessed flag
+ return;
+ }
+ BundleDescription[] bundles = getBundles();
for (int i = 0; i < bundles.length; i++)
- ((BundleDescriptionImpl) bundles[i]).unload(currentTime, expireTime);
+ ((BundleDescriptionImpl) bundles[i]).unload();
}
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
index ad66a2620..49d28961e 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,6 +33,7 @@ class StateReader {
private boolean lazyLoad = true;
private int numBundles;
+ private boolean accessedFlag = false;
public static final byte STATE_CACHE_VERSION = 22;
public static final byte NULL = 0;
@@ -468,7 +469,16 @@ class StateReader {
return lazyLoad;
}
+ boolean getAccessedFlag() {
+ return accessedFlag;
+ }
+
+ void setAccessedFlag(boolean accessedFlag) {
+ this.accessedFlag = accessedFlag;
+ }
+
synchronized void fullyLoad() {
+ setAccessedFlag(true);
DataInputStream in = null;
try {
in = openLazyFile();
@@ -487,6 +497,7 @@ class StateReader {
}
synchronized void fullyLoad(BundleDescriptionImpl target) throws IOException {
+ setAccessedFlag(true);
DataInputStream in = null;
try {
in = openLazyFile();

Back to the top