Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2007-01-18 17:27:55 -0500
committerThomas Watson2007-01-18 17:27:55 -0500
commit3aee7a199e21cbaf2a95452fb68141ef3370322f (patch)
tree45bc40a1881e8d8fd09849b0676f0395db6d5564
parentaa28d181121c9c54f4c30f7a0b23cef61dc600a3 (diff)
downloadrt.equinox.framework-R32x_v20070118.tar.gz
rt.equinox.framework-R32x_v20070118.tar.xz
rt.equinox.framework-R32x_v20070118.zip
Bug 170767 SecurityException is thrown from EclipseLazyStarterR3_2_2R32x_v20070118
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java23
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseLazyStarter.java4
2 files changed, 24 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
index f934157b9..b7a0d88d0 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
@@ -17,8 +17,7 @@ import java.security.*;
import java.util.Properties;
import java.util.zip.ZipFile;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
+import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -337,4 +336,24 @@ public class SecureAction {
}
}, controlContext);
}
+
+ public void start(final Bundle bundle) throws BundleException {
+ if (System.getSecurityManager() == null) {
+ bundle.start();
+ return;
+ }
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws BundleException {
+ bundle.start();
+ return null;
+ }
+ }, controlContext);
+ return;
+ } catch (PrivilegedActionException e) {
+ if (e.getException() instanceof BundleException)
+ throw (BundleException) e.getException();
+ throw (RuntimeException) e.getException();
+ }
+ }
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseLazyStarter.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseLazyStarter.java
index cc2a31f4f..c3be60bbc 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseLazyStarter.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseLazyStarter.java
@@ -21,11 +21,13 @@ import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
+import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
public class EclipseLazyStarter implements ClassLoadingStatsHook, HookConfigurator {
+ private static SecureAction secureAction = new SecureAction();
public void preFindLocalClass(String name, ClasspathManager manager) throws ClassNotFoundException {
AbstractBundle bundle = (AbstractBundle) manager.getBaseData().getBundle();
@@ -83,7 +85,7 @@ public class EclipseLazyStarter implements ClassLoadingStatsHook, HookConfigurat
// mark this bundle as lazy activated by class load
if (storageHook != null)
storageHook.setActivatedOnClassLoad(true);
- bundle.start();
+ secureAction.start(bundle);
} catch (BundleException e) {
String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CLASSLOADER_ACTIVATION, bundle.getSymbolicName(), Long.toString(bundle.getBundleId()));
manager.getBaseData().getAdaptor().getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, message, 0, e, null));

Back to the top