[jboss-cvs] JBossAS SVN: r80988 - projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 14 00:32:01 EST 2008
Author: anil.saldhana at jboss.com
Date: 2008-11-14 00:32:01 -0500 (Fri, 14 Nov 2008)
New Revision: 80988
Added:
projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/SecurityActions.java
Modified:
projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/ClassHelper.java
Log:
EJBTHREE-1586: add priv blocks
Modified: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/ClassHelper.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/ClassHelper.java 2008-11-14 05:19:06 UTC (rev 80987)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/ClassHelper.java 2008-11-14 05:32:01 UTC (rev 80988)
@@ -89,7 +89,7 @@
return null;
// TODO: what is faster? scan or catch exception?
- for(Method method : target.getDeclaredMethods())
+ for(Method method : SecurityActions.getDeclaredMethods(target))
{
if(method.getName().equals(methodName))
{
@@ -190,7 +190,7 @@
if(cls == null)
return;
- for(Method method : cls.getDeclaredMethods())
+ for(Method method : SecurityActions.getDeclaredMethods(cls))
{
if(method.getName().equals(methodName))
methods.add(method);
@@ -208,7 +208,7 @@
}
// For all declared methods
- for (Method method : clazz.getDeclaredMethods())
+ for (Method method : SecurityActions.getDeclaredMethods(clazz))
{
if (method.getName().startsWith(methodNamePrefix))
methods.add(method);
Added: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/SecurityActions.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/SecurityActions.java (rev 0)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/lang/SecurityActions.java 2008-11-14 05:32:01 UTC (rev 80988)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.common.lang;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana at redhat.com
+ * @since Nov 13, 2008
+ */
+class SecurityActions
+{
+ static Method[] getDeclaredMethods(final Class<?> cls)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<Method[]>()
+ {
+ public Method[] run()
+ {
+ return cls.getDeclaredMethods();
+ }
+ });
+ }
+
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list