[java-identity-provider COMMIT] in /trunk/idp-attribute-filter-api/src: main/java/net/shibboleth/idp/attribute/filter...

noreply at shibboleth.net noreply at shibboleth.net
Mon Jun 3 13:28:01 EDT 2013


Author: rdw
Date: Mon Jun  3 13:28:01 2013
New Revision: 4513

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4513&view=rev
Log:
IDP-283 couple of missed checkins.

Modified:
    trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java
    trunk/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/MockMatcher.java

Modified: trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java?rev=4513&r1=4512&r2=4513&view=diff
==============================================================================
--- trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java (original)
+++ trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java Mon Jun  3 13:28:01 2013
@@ -211,18 +211,23 @@
      * @param attributes attributes that have been filtered
      */
     public void setFilteredAttributes(@Nullable @NullableElements final Collection<Attribute> attributes) {
-        Map<String, Attribute> checkedAttributes =
-                MapConstraints.constrainedMap(new HashMap<String, Attribute>(attributes.size()),
-                        MapConstraints.notNull());
-
-        if (attributes != null) {
-            for (Attribute attribute : attributes) {
-                if (attribute != null) {
-                    checkedAttributes.put(attribute.getId(), attribute);
-                }
-            }
-        }
-
-        filteredAttributes = checkedAttributes;
+        
+        if (null == attributes) {
+            filteredAttributes = Collections.EMPTY_MAP;
+        } else {
+            final Map<String, Attribute> checkedAttributes =
+                    MapConstraints.constrainedMap(new HashMap<String, Attribute>(attributes.size()),
+                            MapConstraints.notNull());
+    
+            if (attributes != null) {
+                for (Attribute attribute : attributes) {
+                    if (attribute != null) {
+                        checkedAttributes.put(attribute.getId(), attribute);
+                    }
+                }
+            }
+    
+            filteredAttributes = checkedAttributes;
+        }
     }
 }

Modified: trunk/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/MockMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/MockMatcher.java?rev=4513&r1=4512&r2=4513&view=diff
==============================================================================
--- trunk/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/MockMatcher.java (original)
+++ trunk/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/MockMatcher.java Mon Jun  3 13:28:01 2013
@@ -60,8 +60,8 @@
     /** to return from getMatchingValues(). */
     private boolean retVal;
 
-    /** do we fail when validate is called? */
-    private boolean failValidate;
+    /** do we fail when validate is called? do we fail when we are called?*/
+    private boolean fails;
 
     /** what was passed to getMatchingValues(). */
     private AttributeFilterContext contextUsed;
@@ -95,6 +95,9 @@
     /** {@inheritDoc} */
     public Set<AttributeValue> getMatchingValues(Attribute attribute, AttributeFilterContext filterContext)
             throws AttributeFilterException {
+        if (fails) {
+            throw new MatcherException("throws");
+        }
         if (!Objects.equal(attribute.getId(), matchingAttribute)) {
             return Collections.EMPTY_SET;
         }
@@ -115,7 +118,7 @@
 
     /** {@inheritDoc} */
     public void validate() throws ComponentValidationException {
-        if (failValidate) {
+        if (fails) {
             throw new ComponentValidationException();
         }
         validated = true; 
@@ -157,11 +160,14 @@
     }
 
     public void setFailValidate(boolean doFail) {
-        failValidate = doFail;
+        fails = doFail;
     }
 
     /** {@inheritDoc} */
     public boolean matches(@Nonnull AttributeFilterContext filterContext) throws AttributeFilterException {
+        if (fails) {
+            throw new MatcherException("oops");
+        }
         contextUsed = filterContext;
         return retVal;
     }



More information about the commits mailing list