[jboss-cvs] JBossAS SVN: r68067 - in branches/Branch_4_2: testsuite/src/main/org/jboss/test/security/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Dec 8 14:19:17 EST 2007
Author: anil.saldhana at jboss.com
Date: 2007-12-08 14:19:17 -0500 (Sat, 08 Dec 2007)
New Revision: 68067
Modified:
branches/Branch_4_2/j2ee/src/main/javax/security/jacc/EJBMethodPermission.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/test/EJBPermissionUnitTestCase.java
Log:
JBAS-5014: rollback the change made to EJBMethodPermission
Modified: branches/Branch_4_2/j2ee/src/main/javax/security/jacc/EJBMethodPermission.java
===================================================================
--- branches/Branch_4_2/j2ee/src/main/javax/security/jacc/EJBMethodPermission.java 2007-12-08 18:46:15 UTC (rev 68066)
+++ branches/Branch_4_2/j2ee/src/main/javax/security/jacc/EJBMethodPermission.java 2007-12-08 19:19:17 UTC (rev 68067)
@@ -377,7 +377,8 @@
implies = methodInterface.equals(perm.methodInterface);
}
// Check the method signature
- if( implies == true && methodSig != null && !methodSig.equals(""))
+ if( implies == true && methodSig != null)
+ // if( implies == true && methodSig != null && !(methodSig.equals("")&&perm.methodSig == null))
{
implies = methodSig.equals(perm.methodSig);
}
@@ -418,16 +419,16 @@
return tmp.toString();
}
- private static String[] convertParameters(Class[] params)
+ private static String[] convertParameters(Class<?>[] params)
{
- ArrayList tmp = new ArrayList();
+ ArrayList<String> tmp = new ArrayList<String>();
for(int p = 0; p < params.length; p++)
{
- Class c = params[p];
+ Class<?> c = params[p];
if( c.isArray() )
{
StringBuffer sb = new StringBuffer();
- Class subType = c.getComponentType();
+ Class<?> subType = c.getComponentType();
sb.append(subType.getName());
// Convert to type[][]...[]
while( subType != null )
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/test/EJBPermissionUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/test/EJBPermissionUnitTestCase.java 2007-12-08 18:46:15 UTC (rev 68066)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/test/EJBPermissionUnitTestCase.java 2007-12-08 19:19:17 UTC (rev 68067)
@@ -33,6 +33,7 @@
/** Tests of the JAAC EJB*Permissions
*
* @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at jboss.org
* @version $Revision$
*/
public class EJBPermissionUnitTestCase
@@ -88,14 +89,14 @@
*/
public void testCtor2() throws Exception
{
- Class[] createSig = {};
+ Class<?>[] createSig = {};
Method method = AHome.class.getMethod("create", createSig);
EJBMethodPermission p = new EJBMethodPermission("someEJB", "Home", method);
String actions = p.getActions();
assertTrue("actions("+actions+") == create,Home,",
actions.equals("create,Home,"));
- Class[] methodXSig = {int.class};
+ Class<?>[] methodXSig = {int.class};
Method methodX = ARemote.class.getMethod("methodX", methodXSig);
p = new EJBMethodPermission("someEJB", "Remote", methodX);
actions = p.getActions();
@@ -195,6 +196,14 @@
p0 = new EJBMethodPermission("someEJB", "methodX,Local,int,java.lang.String");
assertTrue("p0.implies(p1)", p0.implies(p1));
+
+ p0 = new EJBMethodPermission("someEJB", "methodX");
+ p1 = new EJBMethodPermission("someEJB", "methodX,,");
+ assertTrue("p0.implies(p1)", p0.implies(p1));
+
+ p0 = new EJBMethodPermission("ejbName", null, null, new String[0]);
+ p1 = new EJBMethodPermission("ejbName", "create", dummyInterface.class.getMethods()[0]);
+ assertTrue("p0.implies(p1)", p0.implies(p1));
}
public void testNotImpliesPermission() throws Exception
@@ -230,5 +239,12 @@
p0 = new EJBMethodPermission("someEJB", ",,int,java.lang.String2");
assertTrue("! p0.implies(p1)", p0.implies(p1) == false);
+
+ p0 = new EJBMethodPermission("ejbName", null, null, new String[0]);
+ p1 = new EJBMethodPermission("ejbName", "a", "LocalHome",
+ new String[]{"java.lang.String"});
+ assertTrue("!p0.implies(p1)", p0.implies(p1) == false);
}
+
+ public interface dummyInterface { void noop();}
}
More information about the jboss-cvs-commits
mailing list