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

noreply at shibboleth.net noreply at shibboleth.net
Mon Jul 6 10:26:02 EDT 2015


Author: rdw
Date: Mon Jul  6 10:26:02 2015
New Revision: 7622

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7622&view=rev
Log:
IDP-700 do not record 'expected' failures from DataConnectors

'noResultAnError' and 'multipleResultsAnError' are "expected" failures from a
data connector in as much as the failure should not throw the attribute resolver
offline.

For now we specifically filter on these two new errors.  We may need to make this
more generic if we add more "expected" failures.

Added:
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/MultipleResultAnErrorResolutionException.java
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/NoResultAnErrorResolutionException.java
Modified:
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractDataConnector.java
    trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java

Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractDataConnector.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractDataConnector.java?rev=7622&r1=7621&r2=7622&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractDataConnector.java	(original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractDataConnector.java	Mon Jul  6 10:26:02 2015
@@ -124,6 +124,9 @@
         final Map<String, IdPAttribute> result;
         try {
             result = doDataConnectorResolve(resolutionContext, workContext);
+        } catch (NoResultAnErrorResolutionException | MultipleResultAnErrorResolutionException e) {
+            // Do not record these failures, they are 'expected'
+            throw e;
         } catch (Exception e) {
             setLastFail(System.currentTimeMillis());
             throw e;

Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java?rev=7622&r1=7621&r2=7622&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java	(original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java	Mon Jul  6 10:26:02 2015
@@ -28,6 +28,8 @@
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.idp.attribute.resolver.MultipleResultAnErrorResolutionException;
+import net.shibboleth.idp.attribute.resolver.NoResultAnErrorResolutionException;
 import net.shibboleth.idp.attribute.resolver.ResolutionException;
 import net.shibboleth.idp.attribute.resolver.dc.AbstractMappingStrategy;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -57,11 +59,11 @@
         if (results.size() == 0) {
             log.debug("Results did not contain any entries, nothing to map");
             if (isNoResultAnError()) {
-                throw new ResolutionException("No entries returned from search");
+                throw new NoResultAnErrorResolutionException("No entries returned from search");
             }
             return null;
         } else if (results.size() > 1 && isMultipleResultsAnError()) {
-            throw new ResolutionException("Multiple entries returned from search");
+            throw new MultipleResultAnErrorResolutionException("Multiple entries returned from search");
         }
 
         final Map<String,IdPAttribute> attributes = new HashMap<>(results.size());



More information about the commits mailing list