[jboss-cvs] JBossAS SVN: r101712 - projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/finder.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 2 07:55:19 EST 2010


Author: anil.saldhana at jboss.com
Date: 2010-03-02 07:55:18 -0500 (Tue, 02 Mar 2010)
New Revision: 101712

Modified:
   projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/finder/AttributeFinder.java
Log:
SECURITY-461: avoid potential NPE

Modified: projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/finder/AttributeFinder.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/finder/AttributeFinder.java	2010-03-02 12:21:46 UTC (rev 101711)
+++ projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/finder/AttributeFinder.java	2010-03-02 12:55:18 UTC (rev 101712)
@@ -40,12 +40,10 @@
 
 
 import java.net.URI;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -175,9 +173,18 @@
                     module.findAttribute(attributeType, attributeId, issuer,
                                          subjectCategory, context,
                                          designatorType);
+                
+                //If a module returned null
+                if(result == null)
+                {
+                   if (logger.isLoggable(Level.WARNING))
+                      logger.log(Level.WARNING, "Module returned null:" + module.getClass().getCanonicalName() +
+                            " for attributeID:" + attributeId);
+                   result = new EvaluationResult(BagAttribute.createEmptyBag(attributeType));
+                }
 
                 // if there was an error, we stop right away
-                if (result.indeterminate()) {
+                if (result == null || result.indeterminate()) {
                     if (logger.isLoggable(Level.INFO))
                         logger.info("Error while trying to resolve values: " +
                                     result.getStatus().getMessage());




More information about the jboss-cvs-commits mailing list