diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ErrorPageErrorHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ErrorPageErrorHandler.java index fa89086ed339..ce368fbbe970 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ErrorPageErrorHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ErrorPageErrorHandler.java @@ -93,7 +93,7 @@ public String getErrorPage(HttpServletRequest request) if (error instanceof ServletException && _unwrapServletException) { - Throwable unwrapped = getFirstNonServletException(error, matchedThrowable); + Throwable unwrapped = unwrapServletException(error, matchedThrowable); if (unwrapped != null) { request.setAttribute(Dispatcher.ERROR_EXCEPTION, unwrapped); @@ -178,13 +178,13 @@ public String getErrorPage(HttpServletRequest request) * @param matchedThrowable the class we found matching the error page (can be null) * @return the first non {@link ServletException} from root cause chain */ - private Throwable getFirstNonServletException(Throwable t, Class matchedThrowable) + private Throwable unwrapServletException(Throwable t, Class matchedThrowable) { if (matchedThrowable != null && t.getClass() == matchedThrowable) return t; if (t instanceof ServletException && t.getCause() != null) { - return getFirstNonServletException(t.getCause(), matchedThrowable); + return unwrapServletException(t.getCause(), matchedThrowable); } return t; } diff --git a/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/ErrorPageErrorHandler.java b/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/ErrorPageErrorHandler.java index 8c4806c955d0..d043ae88bba9 100644 --- a/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/ErrorPageErrorHandler.java +++ b/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/ErrorPageErrorHandler.java @@ -98,7 +98,7 @@ public String getErrorPage(HttpServletRequest request) if (error instanceof ServletException && _unwrapServletException) { - Throwable unwrapped = getFirstNonServletException(error, matchedThrowable); + Throwable unwrapped = unwrapServletException(error, matchedThrowable); if (unwrapped != null) { request.setAttribute(Dispatcher.ERROR_EXCEPTION, unwrapped); @@ -183,13 +183,13 @@ public String getErrorPage(HttpServletRequest request) * @param matchedThrowable the class we found matching the error page (can be null) * @return the first non {@link ServletException} from root cause chain */ - private Throwable getFirstNonServletException(Throwable t, Class matchedThrowable) + private Throwable unwrapServletException(Throwable t, Class matchedThrowable) { if (matchedThrowable != null && t.getClass() == matchedThrowable) return t; if (t instanceof ServletException && t.getCause() != null) { - return getFirstNonServletException(t.getCause(), matchedThrowable); + return unwrapServletException(t.getCause(), matchedThrowable); } return t; }