Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-08-08 18:38:01 +0000
committerThomas Watson2012-08-08 18:40:27 +0000
commit5eba75bf393e442e24f5428afcd69cc2131db4a1 (patch)
tree3462e7283ff0c72728074c2e3902ec3d9b7475e2 /bundles/org.eclipse.osgi/supplement/src
parent0a75b9514308531e0df54902f3534de2954c51bb (diff)
downloadrt.equinox.framework-5eba75bf393e442e24f5428afcd69cc2131db4a1.tar.gz
rt.equinox.framework-5eba75bf393e442e24f5428afcd69cc2131db4a1.tar.xz
rt.equinox.framework-5eba75bf393e442e24f5428afcd69cc2131db4a1.zip
isolate caller from permission to get context.
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement/src')
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
index 2e654b16c..47287f549 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
@@ -463,4 +463,15 @@ public class SecureAction {
public void start(final Bundle bundle) throws BundleException {
start(bundle, 0);
}
+
+ public BundleContext getContext(final Bundle bundle) {
+ if (System.getSecurityManager() == null) {
+ return bundle.getBundleContext();
+ }
+ return AccessController.doPrivileged(new PrivilegedAction<BundleContext>() {
+ public BundleContext run() {
+ return bundle.getBundleContext();
+ }
+ }, controlContext);
+ }
}

Back to the top