[seam-commits] Seam SVN: r8486 - in trunk/src/main/org/jboss/seam: security/permission and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 21 10:06:45 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-07-21 10:06:45 -0400 (Mon, 21 Jul 2008)
New Revision: 8486

Modified:
   trunk/src/main/org/jboss/seam/annotations/security/permission/Identifier.java
   trunk/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
Log:
IdentifierPolicy not required

Modified: trunk/src/main/org/jboss/seam/annotations/security/permission/Identifier.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/permission/Identifier.java	2008-07-20 13:53:49 UTC (rev 8485)
+++ trunk/src/main/org/jboss/seam/annotations/security/permission/Identifier.java	2008-07-21 14:06:45 UTC (rev 8486)
@@ -22,7 +22,7 @@
 @Retention(RUNTIME)
 @Inherited
 public @interface Identifier
-{
-   Class<? extends IdentifierStrategy> value();
+{  
+   Class<? extends IdentifierStrategy> value() default IdentifierStrategy.class;
    String name() default "";
 }

Modified: trunk/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2008-07-20 13:53:49 UTC (rev 8485)
+++ trunk/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2008-07-21 14:06:45 UTC (rev 8486)
@@ -56,26 +56,28 @@
          {
             Class<? extends IdentifierStrategy> strategyClass = 
                target.getClass().getAnnotation(Identifier.class).value();
-            try
+            
+            if (strategyClass != IdentifierStrategy.class)
             {
-               strategy = strategyClass.newInstance();
-               strategies.put(target.getClass(), strategy);
+               try
+               {
+                  strategy = strategyClass.newInstance();
+                  strategies.put(target.getClass(), strategy);
+               }
+               catch (Exception ex)
+               {
+                  throw new RuntimeException("Error instantiating IdentifierStrategy for object " + target, ex);
+               }
             }
-            catch (Exception ex)
-            {
-               throw new RuntimeException("Error instantiating IdentifierStrategy for object " + target, ex);
-            }
          }
-         else
+
+         for (IdentifierStrategy s : registeredStrategies)
          {
-            for (IdentifierStrategy s : registeredStrategies)
+            if (s.canIdentify(target.getClass()))
             {
-               if (s.canIdentify(target.getClass()))
-               {
-                  strategy = s;
-                  strategies.put(target.getClass(), strategy);
-                  break;
-               }
+               strategy = s;
+               strategies.put(target.getClass(), strategy);
+               break;
             }
          }
       }




More information about the seam-commits mailing list