diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-04-04 17:05:51 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-04-04 17:05:51 +0000 |
commit | 8c878b45dee35c5e3d57e838513d9d4d475e9d02 (patch) | |
tree | 6c8b579b5fe3fbf3dedbf14473f44c7528c0ca9b /src/main/javassist/util | |
parent | c4b9da1f23695844fc4535ad6b79c0eb59191ae1 (diff) | |
download | javassist-8c878b45dee35c5e3d57e838513d9d4d475e9d02.tar.gz javassist-8c878b45dee35c5e3d57e838513d9d4d475e9d02.zip |
for fixing JASSIST-75
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@475 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/util')
-rw-r--r-- | src/main/javassist/util/proxy/SerializedProxy.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main/javassist/util/proxy/SerializedProxy.java b/src/main/javassist/util/proxy/SerializedProxy.java index af866efe..5092e992 100644 --- a/src/main/javassist/util/proxy/SerializedProxy.java +++ b/src/main/javassist/util/proxy/SerializedProxy.java @@ -17,6 +17,10 @@ package javassist.util.proxy; import java.io.Serializable; import java.io.ObjectStreamException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.security.ProtectionDomain; /** * A proxy object is converted into an instance of this class @@ -52,9 +56,18 @@ class SerializedProxy implements Serializable { * @return loaded class * @throws ClassNotFoundException for any error */ - protected Class loadClass(String className) throws ClassNotFoundException { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - return cl.loadClass(className); + protected Class loadClass(final String className) throws ClassNotFoundException { + try { + return (Class)AccessController.doPrivileged(new PrivilegedExceptionAction(){ + public Object run() throws Exception{ + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + return Class.forName(className, true, cl); + } + }); + } + catch (PrivilegedActionException pae) { + throw new RuntimeException("cannot load the class: " + className, pae.getException()); + } } Object readResolve() throws ObjectStreamException { |