From 6fa9509fd0dcdb631c0f38365095759a1a670656 Mon Sep 17 00:00:00 2001 From: starksm Date: Tue, 9 May 2006 22:14:14 +0000 Subject: [PATCH] JASSIST-18, Use of the system classloader for the case of a superclass with a null classloader was too restrictive in that it required javassist to be loaded by the system classloader. Instead use the javassist ProxyFactory.class classloader. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@270 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/util/proxy/ProxyFactory.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java index 63088940..00778d7f 100644 --- a/src/main/javassist/util/proxy/ProxyFactory.java +++ b/src/main/javassist/util/proxy/ProxyFactory.java @@ -178,16 +178,19 @@ public class ProxyFactory { protected ClassLoader getClassLoader() { // return Thread.currentThread().getContextClassLoader(); - ClassLoader loader; + ClassLoader loader = null; if (superClass != null && !superClass.getName().equals("java.lang.Object")) loader = superClass.getClassLoader(); else if (interfaces != null && interfaces.length > 0) loader = interfaces[0].getClassLoader(); - else - loader = this.getClass().getClassLoader(); if (loader == null) - loader = ClassLoader.getSystemClassLoader(); + { + loader = getClass().getClassLoader(); + // In case javassist is in the endorsed dir + if (loader == null) + loader = ClassLoader.getSystemClassLoader(); + } return loader; } -- 2.39.5