Child pages
  • Exception Interceptor
Skip to end of metadata
Go to start of metadata
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Parameters

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Extending the Interceptor

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Examples

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
  • No labels

3 Comments

  1. I found the following way to use the ExceptionInterceptor in my application:

    public class ExceptionInterceptor extends ExceptionMappingInterceptor {
    private Logger logger = Logger.getLogger(ExceptionInterceptor.class);
    private ExceptionHandler exceptionHandler;

    protected void publishException(ActionInvocation invocation, ExceptionHolder exceptionHolder)

    Unknown macro: { logger.info("ExceptionInterceptor invoked"); invocation.getInvocationContext().getValueStack().set(ActionConstants.ERROR_KEY, exceptionHolder.exception); }

    }

    I take the exceptionholder object and put it in the valuestack.

    I configure this custom Interceptor in the interceptor.xml. I also created a Error.jsp to be invoked once this exceptionInterceptor traps an exception to display the exception stack trace
    in a window.

    1. The exception and exceptionStack are already made available on the stack, thus on the error page the exception is mapped to--what additional benefit does this provide? See Exception Configuration for details.