in web/src/main/java/org/apache/shiro/web/servlet/AdviceFilter.java [170:201]
protected void cleanup(ServletRequest request, ServletResponse response, Exception existing)
throws ServletException, IOException {
Exception exception = existing;
try {
afterCompletion(request, response, exception);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Successfully invoked afterCompletion method.");
}
} catch (Exception e) {
if (exception == null) {
exception = e;
} else {
LOGGER.debug("afterCompletion implementation threw an exception. This will be ignored to "
+ "allow the original source exception to be propagated.", e);
}
}
if (exception != null) {
if (exception instanceof ServletException) {
throw (ServletException) exception;
} else if (exception instanceof IOException) {
throw (IOException) exception;
} else {
if (LOGGER.isDebugEnabled()) {
String msg = "Filter execution resulted in an unexpected Exception "
+ "(not IOException or ServletException as the Filter API recommends). "
+ "Wrapping in ServletException and propagating.";
LOGGER.debug(msg);
}
throw new ServletException(exception);
}
}
}