Fixes #567 - NPE in ErrorPageErrorHandler debug
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
bdafea3e96
commit
9cf8f2965a
|
@ -61,6 +61,7 @@ public class ErrorPageErrorHandler extends ErrorHandler implements ErrorHandler.
|
||||||
|
|
||||||
PageLookupTechnique pageSource = null;
|
PageLookupTechnique pageSource = null;
|
||||||
|
|
||||||
|
Class<?> matchedThrowable = null;
|
||||||
Throwable th= (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION);
|
Throwable th= (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION);
|
||||||
|
|
||||||
// Walk the cause hierarchy
|
// Walk the cause hierarchy
|
||||||
|
@ -69,7 +70,7 @@ public class ErrorPageErrorHandler extends ErrorHandler implements ErrorHandler.
|
||||||
pageSource = PageLookupTechnique.THROWABLE;
|
pageSource = PageLookupTechnique.THROWABLE;
|
||||||
|
|
||||||
Class<?> exClass=th.getClass();
|
Class<?> exClass=th.getClass();
|
||||||
error_page= (String)_errorPages.get(exClass.getName());
|
error_page= _errorPages.get(exClass.getName());
|
||||||
|
|
||||||
// walk the inheritance hierarchy
|
// walk the inheritance hierarchy
|
||||||
while (error_page == null)
|
while (error_page == null)
|
||||||
|
@ -77,9 +78,12 @@ public class ErrorPageErrorHandler extends ErrorHandler implements ErrorHandler.
|
||||||
exClass= exClass.getSuperclass();
|
exClass= exClass.getSuperclass();
|
||||||
if (exClass==null)
|
if (exClass==null)
|
||||||
break;
|
break;
|
||||||
error_page= (String)_errorPages.get(exClass.getName());
|
error_page = _errorPages.get(exClass.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(error_page != null)
|
||||||
|
matchedThrowable = exClass;
|
||||||
|
|
||||||
th=(th instanceof ServletException)?((ServletException)th).getRootCause():null;
|
th=(th instanceof ServletException)?((ServletException)th).getRootCause():null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,8 +133,11 @@ public class ErrorPageErrorHandler extends ErrorHandler implements ErrorHandler.
|
||||||
switch (pageSource)
|
switch (pageSource)
|
||||||
{
|
{
|
||||||
case THROWABLE:
|
case THROWABLE:
|
||||||
dbg.append(" (from Throwable ");
|
dbg.append(" (using matched Throwable ");
|
||||||
dbg.append(th.getClass().getName());
|
dbg.append(matchedThrowable.getName());
|
||||||
|
dbg.append(" / actually thrown as ");
|
||||||
|
Throwable originalThrowable = (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION);
|
||||||
|
dbg.append(originalThrowable.getClass().getName());
|
||||||
dbg.append(')');
|
dbg.append(')');
|
||||||
LOG.debug(dbg.toString(),th);
|
LOG.debug(dbg.toString(),th);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue