[java-opensaml] branch master updated: Add ability to map handler exceptions to an action event.

Scott Cantor cantor.2 at osu.edu
Mon Jul 30 20:17:37 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=5ab7255e929d82d4ffdbd6225729d92ea2d2f9b5

The following commit(s) were added to refs/heads/master by this push:
       new  5ab7255   Add ability to map handler exceptions to an action event.
5ab7255 is described below

commit 5ab7255e929d82d4ffdbd6225729d92ea2d2f9b5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jul 30 20:17:35 2018 -0400

    Add ability to map handler exceptions to an action event.
---
 .../AbstractHandlerDelegatingProfileAction.java       | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractHandlerDelegatingProfileAction.java b/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractHandlerDelegatingProfileAction.java
index feddecd..2d8d73a 100644
--- a/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractHandlerDelegatingProfileAction.java
+++ b/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractHandlerDelegatingProfileAction.java
@@ -34,6 +34,7 @@ import com.google.common.base.Predicates;
 
 import net.shibboleth.utilities.java.support.component.DestructableComponent;
 import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
  * Base class for a profile action which just delegates to an instance of {@link MessageHandler}.
@@ -51,6 +52,9 @@ public abstract class AbstractHandlerDelegatingProfileAction<DelegateType extend
     
     /** Lookup function for the message context on which to operate. */
     @Nonnull private ContextDataLookupFunction<ProfileRequestContext, MessageContext> messageContextLookup;
+
+    /** An event to signal in the event of a handler exception. */
+    @Nullable private String errorEvent;
     
     /**
      * Constructor.
@@ -85,6 +89,15 @@ public abstract class AbstractHandlerDelegatingProfileAction<DelegateType extend
         delegate = Constraint.isNotNull(delegateInstance, "Delegate instance may not be null");
         messageContextLookup = Constraint.isNotNull(lookup, "MessageContext lookup function may not be null");
     }
+
+    /**
+     * Set the event to signal in the event of a handler exception.
+     * 
+     * @param event event to signal
+     */
+    public void setErrorEvent(@Nullable final String event) {
+        errorEvent = StringSupport.trimOrNull(event);
+    }
     
     /** {@inheritDoc} */
     protected void doDestroy() {
@@ -149,7 +162,11 @@ public abstract class AbstractHandlerDelegatingProfileAction<DelegateType extend
             delegate.invoke(messageContext);
             ActionSupport.buildProceedEvent(profileRequestContext);
         } catch (final MessageHandlerException e) {
-            ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
+            if (errorEvent != null) {
+                ActionSupport.buildEvent(profileRequestContext, errorEvent);
+            } else {
+                ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
+            }
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list