diff options
author | Thomas Watson | 2013-08-27 17:04:13 +0000 |
---|---|---|
committer | Thomas Watson | 2013-08-27 17:04:13 +0000 |
commit | 783d384074eb51fd2fad3fd150d7cb763ad10cda (patch) | |
tree | 4421df96c2c8b61878f47868634ddee8eb68c429 | |
parent | 79653340f4fe73759a673da9eedc9adb287ecc1c (diff) | |
download | rt.equinox.framework-783d384074eb51fd2fad3fd150d7cb763ad10cda.tar.gz rt.equinox.framework-783d384074eb51fd2fad3fd150d7cb763ad10cda.tar.xz rt.equinox.framework-783d384074eb51fd2fad3fd150d7cb763ad10cda.zip |
Bug 415956 - Starting eclipse with the security manager enabled is slow
and unusable
2 files changed, 28 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java index 02eddcdce..822d4c688 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2013 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 @@ -10,9 +10,10 @@ *******************************************************************************/ package org.eclipse.osgi.tests.security; +import java.util.ArrayList; +import java.util.Collection; import junit.framework.TestSuite; -import org.osgi.framework.AdminPermission; -import org.osgi.framework.Bundle; +import org.osgi.framework.*; import org.osgi.service.condpermadmin.*; public class OSGiAPICertificateTest extends BaseSecurityTest { @@ -53,6 +54,8 @@ public class OSGiAPICertificateTest extends BaseSecurityTest { private static ConditionInfo info09True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain07True}); private static ConditionInfo info10True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain08True}); + private Collection<Bundle> installedBundles = new ArrayList<Bundle>(); + public static TestSuite suite() { return new TestSuite(OSGiAPICertificateTest.class); } @@ -79,6 +82,19 @@ public class OSGiAPICertificateTest extends BaseSecurityTest { protected void tearDown() throws Exception { super.tearDown(); + for (Bundle b : installedBundles) { + try { + b.uninstall(); + } catch (BundleException e) { + // do nothing + } + } + } + + protected Bundle installBundle(String bundlePath) { + Bundle b = super.installBundle(bundlePath); + installedBundles.add(b); + return b; } public void testBundleSignerCondition01() { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java index 83b84b274..bb25ea2d9 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java @@ -172,6 +172,7 @@ public class EquinoxBundle implements Bundle, BundleReference { private final Module module; private final Object monitor = new Object(); private BundleContextImpl context; + private volatile SignerInfo[] signerInfos; class EquinoxSystemModule extends SystemModule { public EquinoxSystemModule(ModuleContainer container) { @@ -368,6 +369,7 @@ public class EquinoxBundle implements Bundle, BundleReference { try { Storage storage = equinoxContainer.getStorage(); storage.update(module, storage.getContentConnection(module, null, input)); + signerInfos = null; } catch (IOException e) { throw new BundleException("Error reading bundle content.", e); //$NON-NLS-1$ } @@ -637,9 +639,14 @@ public class EquinoxBundle implements Bundle, BundleReference { if (factory == null) { return Collections.emptyMap(); } + try { - SignedContent signedContent = factory.getSignedContent(this); - SignerInfo[] infos = signedContent.getSignerInfos(); + SignerInfo[] infos = signerInfos; + if (infos == null) { + SignedContent signedContent = factory.getSignedContent(this); + infos = signedContent.getSignerInfos(); + signerInfos = infos; + } if (infos.length == 0) return Collections.emptyMap(); Map<X509Certificate, List<X509Certificate>> results = new HashMap<X509Certificate, List<X509Certificate>>(infos.length); |