[java-identity-provider COMMIT] in /trunk/idp-conf/src/main/resources: system/flows/saml/saml-abstract-flow.xml views...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Nov 18 15:08:25 EST 2014
Author: scantor
Date: Tue Nov 18 15:08:24 2014
New Revision: 6935
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6935&view=rev
Log:
Trap runtime exceptions by logging and then passing on to error handling.
Modified:
trunk/idp-conf/src/main/resources/system/flows/saml/saml-abstract-flow.xml
trunk/idp-conf/src/main/resources/views/error.vm
Modified: trunk/idp-conf/src/main/resources/system/flows/saml/saml-abstract-flow.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/flows/saml/saml-abstract-flow.xml?rev=6935&r1=6934&r2=6935&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/flows/saml/saml-abstract-flow.xml (original)
+++ trunk/idp-conf/src/main/resources/system/flows/saml/saml-abstract-flow.xml Tue Nov 18 15:08:24 2014
@@ -123,6 +123,13 @@
<transition to="HandleErrorWithView" />
</action-state>
+ <!-- Passthrough state if an exception is thrown. -->
+
+ <action-state id="LogRuntimeException">
+ <evaluate expression="T(org.slf4j.LoggerFactory).getLogger('net.shibboleth.idp.saml.profile').error('Uncaught runtime exception', rootCauseException)" />
+ <transition to="HandleError" />
+ </action-state>
+
<!-- Unsuccessful terminal state. -->
<end-state id="HandleErrorWithView" view="#{MapEventToView.apply(currentEvent)}">
@@ -149,6 +156,7 @@
defined by action in child flows.
-->
<global-transitions>
+ <transition on-exception="java.lang.RuntimeException" to="LogRuntimeException" />
<transition on="#{!'proceed'.equals(currentEvent.id)}" to="HandleError" />
</global-transitions>
Modified: trunk/idp-conf/src/main/resources/views/error.vm
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/views/error.vm?rev=6935&r1=6934&r2=6935&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/views/error.vm (original)
+++ trunk/idp-conf/src/main/resources/views/error.vm Tue Nov 18 15:08:24 2014
@@ -7,7 +7,14 @@
## request - HttpServletRequest
## response - HttpServletResponse
-#if ($flowRequestContext)
+#if ($rootCauseException)
+ ## This handles uncaught runtime exceptions within flows, which we can't plan for.
+ #set ($springContext = $flowRequestContext.getActiveFlow().getApplicationContext())
+ #set ($locale = $flowRequestContext.getExternalContext().getLocale())
+ #set ($titleSuffix = "Uncaught Exception")
+ #set ($message = $encoder.encodeForHTML($rootCauseException.toString()))
+#elseif ($flowRequestContext)
+ ## This handles flow events, the most common case.
#set ($eventId = $flowRequestContext.getCurrentEvent().getId())
#set ($springContext = $flowRequestContext.getActiveFlow().getApplicationContext())
#set ($locale = $flowRequestContext.getExternalContext().getLocale())
@@ -23,11 +30,13 @@
$response.setStatus(500)
#end
#elseif ($exception)
+ ## This handles exceptions that reach the Spring-MVC exception handler.
#set ($eventId = $exception.getClass().getSimpleName())
#set ($eventKey = $springContext.getMessage($eventId, null, "error", $request.getLocale()))
#set ($titleSuffix = $springContext.getMessage("${eventKey}.title", null, "Error", $request.getLocale()))
#set ($message = $springContext.getMessage("${eventKey}.message", null, "ERROR: $eventId", $request.getLocale()))
#else
+ ## This is a catch-all that theoretically shouldn't happen?
#set ($titleSuffix = "Error")
#set ($message = "No specific error available")
#end
More information about the commits
mailing list