aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/util
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2009-04-04 17:05:51 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2009-04-04 17:05:51 +0000
commit8c878b45dee35c5e3d57e838513d9d4d475e9d02 (patch)
tree6c8b579b5fe3fbf3dedbf14473f44c7528c0ca9b /src/main/javassist/util
parentc4b9da1f23695844fc4535ad6b79c0eb59191ae1 (diff)
downloadjavassist-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.java19
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 {