This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new c92ad3fceb Avoid NPE on Servlet exception unwrap
c92ad3fceb is described below
commit c92ad3fcebc30db87c90c45f311e55a769b57772
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 7d6122a130..a51f5caa55 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 0aa177fbe9..e98181fee2 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]