use of org.apache.catalina.deploy.ErrorPage in project Payara by payara.
the class StandardHostValve method findErrorPage.
/**
* Find and return the ErrorPage instance for the specified exception's
* class, or an ErrorPage instance for the closest superclass for which
* there is such a definition. If no associated ErrorPage instance is
* found, return <code>null</code>.
*
* @param context The Context in which to search
* @param exception The exception for which to find an ErrorPage
*/
protected static ErrorPage findErrorPage(Context context, Throwable exception) {
if (exception == null)
return (null);
Class<?> clazz = exception.getClass();
String name = clazz.getName();
while (!Object.class.equals(clazz)) {
ErrorPage errorPage = context.findErrorPage(name);
if (errorPage != null)
return (errorPage);
clazz = clazz.getSuperclass();
if (clazz == null)
break;
name = clazz.getName();
}
return (null);
}
Aggregations