[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security/acl ...

Shane Bryzak Shane_Bryzak at symantec.com
Thu Nov 9 00:59:37 EST 2006


  User: sbryzak2
  Date: 06/11/09 00:59:37

  Modified:    src/main/org/jboss/seam/security/acl 
                        JPAIdentityGenerator.java
  Log:
  unit tests
  
  Revision  Changes    Path
  1.2       +13 -9     jboss-seam/src/main/org/jboss/seam/security/acl/JPAIdentityGenerator.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JPAIdentityGenerator.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/acl/JPAIdentityGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- JPAIdentityGenerator.java	9 Nov 2006 01:26:30 -0000	1.1
  +++ JPAIdentityGenerator.java	9 Nov 2006 05:59:37 -0000	1.2
  @@ -4,7 +4,6 @@
   import java.lang.reflect.Field;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
  -import java.lang.reflect.Modifier;
   import java.util.HashMap;
   import java.util.Map;
   import javax.persistence.Id;
  @@ -45,6 +44,9 @@
               return (Serializable) identityField.get(obj);
             }
             catch (IllegalAccessException ex) { // shouldn't occur
  +            throw new IdentityException(String.format(
  +                "IllegalAccessException reading identifier field on object [%s]",
  +                obj), ex);
             }
           case method:
             try
  @@ -52,10 +54,14 @@
               return identityMethod.invoke(obj);
             }
             catch (IllegalAccessException ex) {
  -            // won't occur - already checked that method is public
  +            throw new IdentityException(String.format(
  +                "IllegalAccessException invoking identifier method on object [%s]",
  +                obj), ex);
             }
             catch (InvocationTargetException ex) {
  -
  +            throw new IdentityException(String.format(
  +                "InvocationTargetException invoking identifier method on object [%s]",
  +                obj), ex);
             }
           default:
             throw new IllegalStateException("Invalid identifier type");
  @@ -111,13 +117,10 @@
                       "Specified class [%s] has illegal identifier method - must accept no parameters.",
                       cls.getName()));
   
  -              if (!Modifier.isPublic(m.getModifiers()))
  -                throw new IllegalArgumentException(String.format(
  -                    "Specified class [%s] has illegal identifier method - must be public.",
  -                    cls.getName()));
  -
                 meta.idType = IdentityType.method;
                 meta.identityMethod = m;
  +
  +              m.setAccessible(true);
                 break;
               }
             }
  @@ -125,8 +128,9 @@
             // If there is no @Id method, check the fields
             if (meta.identityMethod == null)
             {
  -            for (Field f : cls.getFields())
  +            for (Field f : cls.getDeclaredFields())
               {
  +              System.out.println("Field: " + f.getName());
                 if (f.isAnnotationPresent(Id.class))
                 {
                   meta.idType = IdentityType.field;
  
  
  



More information about the jboss-cvs-commits mailing list