[java-identity-provider COMMIT] /trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageH...

noreply at shibboleth.net noreply at shibboleth.net
Thu Apr 10 21:26:04 EDT 2014


Author: scantor
Date: Thu Apr 10 21:26:02 2014
New Revision: 5707

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5707&view=rev
Log:
Trap message handler exceptions and turn into event.

Modified:
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java?rev=5707&r1=5706&r2=5707&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/WebFlowMessageHandlerAdaptor.java Thu Apr 10 21:26:02 2014
@@ -28,6 +28,7 @@
 
 import org.opensaml.messaging.context.MessageContext;
 import org.opensaml.messaging.handler.MessageHandler;
+import org.opensaml.messaging.handler.MessageHandlerException;
 import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.EventContext;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -164,19 +165,25 @@
                         handler.getClass().getName());
                 break;
             default:
-                log.warn("Specified direction '{}' was unknown, skipping handler invocation", direction);
+                log.warn("Action {}: Specified direction '{}' was unknown, skipping handler invocation", getId(),
+                        direction);
                 return ActionSupport.buildProceedEvent(handler);
         } 
         
         if (target == null) {
-            log.warn("Target message context was null, cannot invoke handler");
+            log.warn("Action {}: Target message context was null, cannot invoke handler", getId());
             return ActionSupport.buildEvent(handler, EventIds.INVALID_MSG_CTX);
         }
         
         log.debug("Action {}: Invoking message handler on message context containing a message of type '{}'", getId(), 
                 target.getMessage().getClass().getName());
-        
-        handler.invoke(target);
+        try {
+            handler.invoke(target);
+        } catch (final MessageHandlerException e) {
+            // TODO: probably should be a different event, but we really do need to trap the exception
+            log.warn("Action " + getId() + ": Exception handling message", e);
+            return ActionSupport.buildEvent(handler, EventIds.INVALID_MSG_CTX);
+        }
         
         // TODO same approach as actions, or different?  For now just copy what Scott did, it may all change anyway.
         return getResult(handler, target);



More information about the commits mailing list