/**
* Cache every object for which we are creating method on it.
*/
- private static HashMap objectCache = new HashMap();
+ private static HashMap<Object,Method[]> objectCache =
+ new HashMap<Object,Method[]>();
private static org.apache.juli.logging.Log log=
org.apache.juli.logging.LogFactory.getLog( SecurityUtil.class );
*/
public static void doAsPrivilege(final String methodName,
final Servlet targetObject,
- final Class[] targetType,
+ final Class<?>[] targetType,
final Object[] targetArguments)
throws java.lang.Exception{
*/
public static void doAsPrivilege(final String methodName,
final Servlet targetObject,
- final Class[] targetType,
+ final Class<?>[] targetType,
final Object[] targetArguments,
Principal principal)
throws java.lang.Exception{
Method method = null;
Method[] methodsCache = null;
if(objectCache.containsKey(targetObject)){
- methodsCache = (Method[])objectCache.get(targetObject);
+ methodsCache = objectCache.get(targetObject);
method = findMethod(methodsCache, methodName);
if (method == null){
method = createMethodAndCacheIt(methodsCache,
*/
public static void doAsPrivilege(final String methodName,
final Filter targetObject,
- final Class[] targetType,
+ final Class<?>[] targetType,
final Object[] targetArguments)
throws java.lang.Exception{
*/
public static void doAsPrivilege(final String methodName,
final Filter targetObject,
- final Class[] targetType,
+ final Class<?>[] targetType,
final Object[] targetArguments,
Principal principal)
throws java.lang.Exception{
Method[] methodsCache = null;
if(objectCache.containsKey(targetObject)){
- methodsCache = (Method[])objectCache.get(targetObject);
+ methodsCache = objectCache.get(targetObject);
method = findMethod(methodsCache, methodName);
if (method == null){
method = createMethodAndCacheIt(methodsCache,
try{
Subject subject = null;
- PrivilegedExceptionAction pea = new PrivilegedExceptionAction(){
- public Object run() throws Exception{
+ PrivilegedExceptionAction<Void> pea =
+ new PrivilegedExceptionAction<Void>(){
+ public Void run() throws Exception{
method.invoke(targetObject, targetArguments);
return null;
}
private static Method createMethodAndCacheIt(Method[] methodsCache,
String methodName,
Object targetObject,
- Class[] targetType)
+ Class<?>[] targetType)
throws Exception{
if ( methodsCache == null){