Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
index 18833c4b1..86be6744c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 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
@@ -250,9 +250,18 @@ public class BundleLoader extends ModuleLoader {
// and endless loop if the hook causes re-entry (that would be a bad hook impl)
classLoaderCreated = result;
// only send to hooks if this thread wins in creating the class loader.
- for (ClassLoaderHook hook : hooks) {
- hook.classLoaderCreated(result);
- }
+ final ModuleClassLoader cl = result;
+ // protect with doPriv to avoid bubbling up permission checks that hooks may require
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ for (ClassLoaderHook hook : hooks) {
+ hook.classLoaderCreated(cl);
+ }
+ return null;
+ }
+
+ });
// finally set the class loader for use after calling hooks
classloader = classLoaderCreated;
} else {

Back to the top