Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-11-11 15:47:56 -0500
committerThomas Watson2016-11-11 15:49:23 -0500
commit33ad3dfc7cca7bab93f67c53c8b288bafb251347 (patch)
tree83ef24307bd47674ebd2c1caa71aba02725086e5
parente71e4cbe7f8f7d813d890e522979a490d8f295ab (diff)
downloadrt.equinox.framework-I20161116-2000.tar.gz
rt.equinox.framework-I20161116-2000.tar.xz
rt.equinox.framework-I20161116-2000.zip
the java.base module Change-Id: I788208133cd71e4ce6bbdc92bea890a8cf7d5ce4 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/SystemPolicy.java15
4 files changed, 20 insertions, 13 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
index 3be84911e..7ce416cd5 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
@@ -46,7 +46,7 @@ public class ContextFinder extends ClassLoader implements PrivilegedAction<List<
public ContextFinder(ClassLoader contextClassLoader) {
super(contextClassLoader);
- this.parentContextClassLoader = contextClassLoader != null ? contextClassLoader : new ClassLoader(Object.class.getClassLoader()) {/*boot classloader*/};
+ this.parentContextClassLoader = contextClassLoader != null ? contextClassLoader : EquinoxContainerAdaptor.BOOT_CLASSLOADER;
}
// Return a list of all classloaders on the stack that are neither the
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
index 5f42a20bc..db901c525 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
@@ -182,7 +182,7 @@ public class EquinoxContainer implements ThreadFactory, Runnable {
if (EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_APP.equals(type))
parent = ClassLoader.getSystemClassLoader();
else if (EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_BOOT.equals(type))
- parent = null;
+ parent = EquinoxContainerAdaptor.BOOT_CLASSLOADER;
else if (EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_FWK.equals(type))
parent = EquinoxContainer.class.getClassLoader();
else if (EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_EXT.equals(type)) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
index 560392b4b..282bfb7e1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.internal.framework;
+import java.lang.reflect.Method;
import java.security.ProtectionDomain;
import java.util.*;
import java.util.concurrent.*;
@@ -29,7 +30,18 @@ import org.osgi.framework.hooks.resolver.ResolverHookFactory;
import org.osgi.framework.wiring.BundleRevision;
public class EquinoxContainerAdaptor extends ModuleContainerAdaptor {
- private static final ClassLoader BOOT_CLASSLOADER = new ClassLoader(Object.class.getClassLoader()) { /* boot class loader */};
+ public static final ClassLoader BOOT_CLASSLOADER;
+ static {
+ ClassLoader platformClassLoader = null;
+ try {
+ Method getPlatformClassLoader = ClassLoader.class.getMethod("getPlatformClassLoader"); //$NON-NLS-1$
+ platformClassLoader = (ClassLoader) getPlatformClassLoader.invoke(null);
+ } catch (Throwable t) {
+ // try everything possible to not fail <clinit>
+ platformClassLoader = new ClassLoader(Object.class.getClassLoader()) { /* boot class loader */};
+ }
+ BOOT_CLASSLOADER = platformClassLoader;
+ }
private final EquinoxContainer container;
private final Storage storage;
private final OSGiFrameworkHooks hooks;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/SystemPolicy.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/SystemPolicy.java
index 859837657..7edefe1af 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/SystemPolicy.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/SystemPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
@@ -15,15 +15,10 @@ import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Enumeration;
+import org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor;
public class SystemPolicy implements IBuddyPolicy {
- private static class ParentClassLoader extends ClassLoader {
- protected ParentClassLoader() {
- super(Object.class.getClassLoader());
- }
- }
-
public static final byte BOOT = 0;
public static final byte EXT = 1;
public static final byte APP = 2;
@@ -57,15 +52,15 @@ public class SystemPolicy implements IBuddyPolicy {
case APP :
if (ClassLoader.getSystemClassLoader() != null)
return ClassLoader.getSystemClassLoader();
- return new ParentClassLoader();
+ return EquinoxContainerAdaptor.BOOT_CLASSLOADER;
case BOOT :
- return new ParentClassLoader();
+ return EquinoxContainerAdaptor.BOOT_CLASSLOADER;
case EXT :
if (ClassLoader.getSystemClassLoader() != null)
return ClassLoader.getSystemClassLoader().getParent();
- return new ParentClassLoader();
+ return EquinoxContainerAdaptor.BOOT_CLASSLOADER;
}
return null;
}

Back to the top