diff options
author | Thomas Watson | 2006-04-07 20:57:15 +0000 |
---|---|---|
committer | Thomas Watson | 2006-04-07 20:57:15 +0000 |
commit | 1e3d698d538b4889246f9e1b452c2af778747644 (patch) | |
tree | 11c19b5727c02bb20487fb2be98702fa4eb257b2 | |
parent | f8b331dba1b60a431786565d35597a683e767231 (diff) | |
download | rt.equinox.framework-1e3d698d538b4889246f9e1b452c2af778747644.tar.gz rt.equinox.framework-1e3d698d538b4889246f9e1b452c2af778747644.tar.xz rt.equinox.framework-1e3d698d538b4889246f9e1b452c2af778747644.zip |
Fix to clear certificate cache correctly when loading bundles.
-rw-r--r-- | bundles/org.eclipse.osgi/jarverifier/org/eclipse/osgi/internal/verifier/SignedStorageHook.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/jarverifier/org/eclipse/osgi/internal/verifier/SignedStorageHook.java b/bundles/org.eclipse.osgi/jarverifier/org/eclipse/osgi/internal/verifier/SignedStorageHook.java index af37a409c..0668b931c 100644 --- a/bundles/org.eclipse.osgi/jarverifier/org/eclipse/osgi/internal/verifier/SignedStorageHook.java +++ b/bundles/org.eclipse.osgi/jarverifier/org/eclipse/osgi/internal/verifier/SignedStorageHook.java @@ -19,6 +19,7 @@ import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile; import org.eclipse.osgi.baseadaptor.hooks.StorageHook; import org.eclipse.osgi.framework.util.KeyedElement; import org.eclipse.osgi.internal.provisional.verifier.CertificateChain; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; public class SignedStorageHook implements StorageHook { @@ -26,7 +27,8 @@ public class SignedStorageHook implements StorageHook { static final int HASHCODE = KEY.hashCode(); private static final int STORAGE_VERSION = 1; private static ArrayList saveChainCache = new ArrayList(5); - private static long lastIDSaved; + private static long firstIDSaved = -1; + private static long lastIDSaved = -1; private static ArrayList loadChainCache = new ArrayList(5); private static long lastIDLoaded; @@ -112,9 +114,11 @@ public class SignedStorageHook implements StorageHook { } public void save(DataOutputStream os) throws IOException { - if (lastIDSaved > bundledata.getBundleID()) + getFirstLastID(); + if (firstIDSaved == bundledata.getBundleID()) saveChainCache.clear(); - lastIDSaved = bundledata.getBundleID(); + if (lastIDSaved == bundledata.getBundleID()) + firstIDSaved = lastIDSaved = -1; BundleFile bundleFile = bundledata.getBundleFile(); CertificateChain[] chains = null; String md5Result = null; @@ -179,6 +183,16 @@ public class SignedStorageHook implements StorageHook { os.writeUTF(shaResult); } + private void getFirstLastID() { + if (firstIDSaved >= 0) + return; + Bundle[] bundles = bundledata.getAdaptor().getContext().getBundles(); + if (bundles.length > 1) { + firstIDSaved = bundles[1].getBundleId(); + lastIDSaved = bundles[bundles.length - 1].getBundleId(); + } + } + public void copy(StorageHook storageHook) { // do nothing } |