[java-identity-provider COMMIT] /trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering...
noreply at shibboleth.net
noreply at shibboleth.net
Wed May 22 16:34:51 EDT 2013
Author: tzeller
Date: Wed May 22 16:34:51 2013
New Revision: 4482
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4482&view=rev
Log:
Process all composed matchers even if a composed matcher returns no matching values. Probably a copy-paste error.
Modified:
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcher.java
Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcher.java?rev=4482&r1=4481&r2=4482&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcher.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcher.java Wed May 22 16:34:51 2013
@@ -19,7 +19,6 @@
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -33,15 +32,16 @@
import net.shibboleth.idp.attribute.filtering.AttributeFilteringException;
import net.shibboleth.idp.attribute.filtering.MatchFunctor;
import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
+import net.shibboleth.utilities.java.support.collection.LazySet;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
/**
- * {@link MatchFunctor} that implements the disjunction of matchers. That is, a given attribute value is
- * considered to have matched if it is returned by any of the composed {@link MatchFunctor}.
+ * {@link MatchFunctor} that implements the disjunction of matchers. That is, a given attribute value is considered to
+ * have matched if it is returned by any of the composed {@link MatchFunctor}.
*/
@ThreadSafe
-public class OrMatcher extends AbstractComposedMatcher {
+public class OrMatcher extends AbstractComposedMatcher {
/**
* Constructor.
@@ -51,9 +51,9 @@
public OrMatcher(@Nullable @NullableElements final Collection<MatchFunctor> composedMatchers) {
super(composedMatchers);
}
-
+
/** {@inheritDoc} */
- public boolean evaluatePolicyRule(@Nonnull AttributeFilterContext filterContext)
+ public boolean evaluatePolicyRule(@Nonnull AttributeFilterContext filterContext)
throws AttributeFilteringException {
final List<MatchFunctor> currentMatchers = getComposedMatchers();
ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
@@ -64,10 +64,9 @@
return true;
}
}
- }
+ }
return false;
}
-
/** {@inheritDoc} */
public Set<AttributeValue> getMatchingValues(Attribute attribute, AttributeFilterContext filterContext)
@@ -84,18 +83,12 @@
if (currentMatchers.isEmpty()) {
return Collections.emptySet();
}
- Iterator<MatchFunctor> matcherItr = currentMatchers.iterator();
- Set<AttributeValue> matchingValues = matcherItr.next().getMatchingValues(attribute, filterContext);
- while (matcherItr.hasNext()) {
- matchingValues.addAll(matcherItr.next().getMatchingValues(attribute, filterContext));
- if (matchingValues.isEmpty()) {
- return Collections.emptySet();
- }
+ Set<AttributeValue> matchingValues = new LazySet<AttributeValue>();
+ for (MatchFunctor matchFunctor : getComposedMatchers()) {
+ matchingValues.addAll(matchFunctor.getMatchingValues(attribute, filterContext));
}
return Collections.unmodifiableSet(matchingValues);
}
-
-
}
More information about the commits
mailing list