This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 5f929b94bf99bab8d1b143a8bcb0db8ff274ea7d Author: remm <[email protected]> AuthorDate: Fri Oct 24 12:39:33 2025 +0200 Avoid NPE on Servlet exception unwrap BZ69862 It would add some exception details, but is not fatal. Patch submitted by Eric Blanquer. --- java/org/apache/jasper/servlet/JspServletWrapper.java | 6 ++++-- webapps/docs/changelog.xml | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java index 582ff2501d..cac2ed71a2 100644 --- a/java/org/apache/jasper/servlet/JspServletWrapper.java +++ b/java/org/apache/jasper/servlet/JspServletWrapper.java @@ -516,8 +516,10 @@ public class JspServletWrapper { protected JasperException handleJspException(Exception ex) { try { Throwable realException = ex; - if (ex instanceof ServletException) { - realException = ((ServletException) ex).getRootCause(); + // Unwrap Servlet exception once + if (ex instanceof ServletException servletException + && servletException.getRootCause() != null) { + realException = servletException.getRootCause(); } // Find the first stack frame that represents code generated by diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e8687e8c3d..a56492451a 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -121,6 +121,14 @@ </fix> </changelog> </subsection> + <subsection name="Jasper"> + <changelog> + <fix> + <bug>69862</bug>: Avoid NPE unwrapping Servlet exception which would + hide some exception details. Patch submitted by Eric Blanquer. (remm) + </fix> + </changelog> + </subsection> <subsection name="Other"> <changelog> <update> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
