Skip to content

Commit

Permalink
ARIES-360: Avoid context classloader for proxying java.* classes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/incubator/aries/trunk/blueprint@965593 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Valentin Mahrwald committed Jul 19, 2010
1 parent 457abde commit 19908ab
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -50,6 +50,8 @@ public class ProxySubclassGenerator
// the map of
// Class names to sub-Class names)
private static final Map<ClassLoader, ConcurrentMap<String, String>> proxyClassesByClassLoader;

private static final ClassLoader defaultClassLoader = new ClassLoader() {};

static {
// Ensure that this is a synchronized map as we may use it from multiple
Expand All @@ -67,10 +69,9 @@ public static Class<?> getProxySubclass(Class<?> aClass) throws UnableToProxyExc
LOGGER.debug(AsmInterceptorWrapper.LOG_ENTRY, "getProxySubclass", new Object[] { aClass });

ClassLoader loader = aClass.getClassLoader();
// in the special case where the loader is null we use the thread
// ContextClassLoader
// this is for subclassing java.* or javax.* packages
if (loader == null) loader = Thread.currentThread().getContextClassLoader();
// in the special case where the loader is null we use a default classloader
// this is for subclassing java.* or javax.* packages, so that one will do
if (loader == null) loader = defaultClassLoader;

ConcurrentMap<String, String> proxyMap;
synchronized (loader) {
Expand Down

0 comments on commit 19908ab

Please sign in to comment.