diff options
author | kkhan <kkhan@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2008-02-12 18:55:46 +0000 |
---|---|---|
committer | kkhan <kkhan@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2008-02-12 18:55:46 +0000 |
commit | 78b56629509b8275eade44ca552d3b959ecedde3 (patch) | |
tree | 2e8b6005497972005fdbe3a23a81ccfbffec8baa /src/main/javassist/util/proxy/FactoryHelper.java | |
parent | 1d2f91432f09742e864f221aee8f66f9205f7fd4 (diff) | |
download | javassist-78b56629509b8275eade44ca552d3b959ecedde3.tar.gz javassist-78b56629509b8275eade44ca552d3b959ecedde3.zip |
Make ProxyFactory use privileged blocks when a security manager is present
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@420 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/util/proxy/FactoryHelper.java')
-rw-r--r-- | src/main/javassist/util/proxy/FactoryHelper.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/javassist/util/proxy/FactoryHelper.java b/src/main/javassist/util/proxy/FactoryHelper.java index d844639f..50d1944b 100644 --- a/src/main/javassist/util/proxy/FactoryHelper.java +++ b/src/main/javassist/util/proxy/FactoryHelper.java @@ -39,11 +39,15 @@ public class FactoryHelper { static { try { Class cl = Class.forName("java.lang.ClassLoader"); - defineClass1 = cl.getDeclaredMethod("defineClass", + defineClass1 = SecurityActions.getDeclaredMethod( + cl, + "defineClass", new Class[] { String.class, byte[].class, int.class, int.class }); - defineClass2 = cl.getDeclaredMethod("defineClass", + defineClass2 = SecurityActions.getDeclaredMethod( + cl, + "defineClass", new Class[] { String.class, byte[].class, int.class, int.class, ProtectionDomain.class }); } @@ -173,9 +177,9 @@ public class FactoryHelper { ClassLoader loader, Object[] args) throws Exception { - method.setAccessible(true); + SecurityActions.setAccessible(method, true); Class clazz = (Class)method.invoke(loader, args); - method.setAccessible(false); + SecurityActions.setAccessible(method, false); return clazz; } |