//
// Look up the ExceptionConfig that's associated with this Throwable.
//
Class exClass = ex.getClass();
ExceptionConfig exceptionConfig = null;
if ( actionMapping != null )
{
exceptionConfig = actionMapping.findException( exClass );
}
else
{
// If the mapping was null (i.e., the exception happened before we got the action mapping), look for the
// exception only in the module config.
exceptionConfig = getExceptionConfig( exClass, flowController.getModuleConfig() );
}
//
// If there was no applicable exception handler in the current ModuleConfig, look in Global.app's module.
//
if ( exceptionConfig == null )
{
FlowController fallbackFC =
getFallbackFlowController( flowController, exClass, request, response, getServletContext() );
if ( fallbackFC != null )
{
flowController = fallbackFC;
context = new FlowControllerHandlerContext( request, response, flowController );
exceptionConfig = getExceptionConfig( exClass, flowController.getModuleConfig() );
if ( exceptionConfig != null )
{
// This is the module that will be handling the exception. Ensure that its message resources are
// initialized.
assert request instanceof HttpServletRequest : request.getClass().getName();
InternalUtils.selectModule( flowController.getModuleConfig().getPrefix(),
( HttpServletRequest ) request, getServletContext() );
PageFlowRequestWrapper.get( request ).setCurrentFlowController( flowController );
}
}
actionMapping = null; // This action mapping isn't relevant if we found the exception elsewhere.
}
if ( exceptionConfig != null )
{
if ( _log.isDebugEnabled() )
{
_log.debug( "Found exception-config for exception " + exClass.getName()
+ ": handler=" + exceptionConfig.getHandler() + ", path=" + exceptionConfig.getPath() );
}
//
// First, see if it should be handled by invoking a handler method.
//