[jboss-cvs] JBossAS SVN: r82213 - projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 10 19:49:28 EST 2008
Author: ALRubinger
Date: 2008-12-10 19:49:28 -0500 (Wed, 10 Dec 2008)
New Revision: 82213
Modified:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/SecurityActions.java
Log:
[EJBTHREE-1586] Execute Class.getDecalredMethod() within doPrivileged
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java 2008-12-10 22:59:45 UTC (rev 82212)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/ClassHelper.java 2008-12-11 00:49:28 UTC (rev 82213)
@@ -157,9 +157,10 @@
return method;
}
}
- try
+
+ try
{
- return cls.getDeclaredMethod(methodName, params);
+ return SecurityActions.getDeclaredMethod(cls, methodName, params);
}
catch (NoSuchMethodException e1)
{
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/SecurityActions.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/SecurityActions.java 2008-12-10 22:59:45 UTC (rev 82212)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/lang/SecurityActions.java 2008-12-11 00:49:28 UTC (rev 82213)
@@ -24,6 +24,8 @@
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* Privileged Blocks
@@ -42,5 +44,27 @@
}
});
}
+
+ static Method getDeclaredMethod(final Class<?> clazz, final String methodName, final Class<?>[] params)
+ throws NoSuchMethodException
+ {
+ try
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Method>()
+ {
+ public Method run() throws NoSuchMethodException
+ {
+ return clazz.getDeclaredMethod(methodName, params);
+
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ // Only checked exceptions are wrapped, so this cast should be safe
+ throw (NoSuchMethodException) pae.getException();
+ }
+ }
+
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list