This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit edc455771aa145afc22098a8cec58486e3226418
Author: opencode <[email protected]>
AuthorDate: Mon Oct 19 10:37:48 2026 +0200

    Keep the wrapped exception in the JSP EL exception cause chain
    
    The four JSP EL exception wrappers prepended the JSP location mark to
    the message of the exception being wrapped but set the cause to the
    cause of that exception rather than the exception itself. When the
    wrapped exception had no cause, the wrapper ended up with no cause at
    all, discarding the wrapped exception's type and stack trace so that
    only the prefixed message text survived.
    
    Keep the wrapped exception itself as the cause. Its own cause remains
    reachable transitively, and sites that inspect the cause, such as
    PageContextImpl.handlePageException(), now observe the wrapped
    exception instead of losing it.
    
    Found by code review.
---
 java/org/apache/jasper/el/JspELException.java                  | 2 +-
 java/org/apache/jasper/el/JspMethodNotFoundException.java      | 2 +-
 java/org/apache/jasper/el/JspPropertyNotFoundException.java    | 2 +-
 java/org/apache/jasper/el/JspPropertyNotWritableException.java | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/jasper/el/JspELException.java 
b/java/org/apache/jasper/el/JspELException.java
index 42c9e10406..e8e80cfe40 100644
--- a/java/org/apache/jasper/el/JspELException.java
+++ b/java/org/apache/jasper/el/JspELException.java
@@ -32,6 +32,6 @@ public class JspELException extends ELException {
      * @param e the underlying ELException
      */
     public JspELException(String mark, ELException e) {
-        super(mark + " " + e.getMessage(), e.getCause());
+        super(mark + " " + e.getMessage(), e);
     }
 }
diff --git a/java/org/apache/jasper/el/JspMethodNotFoundException.java 
b/java/org/apache/jasper/el/JspMethodNotFoundException.java
index b5427d3039..7899b0ad23 100644
--- a/java/org/apache/jasper/el/JspMethodNotFoundException.java
+++ b/java/org/apache/jasper/el/JspMethodNotFoundException.java
@@ -32,6 +32,6 @@ public class JspMethodNotFoundException extends 
MethodNotFoundException {
      * @param e the underlying MethodNotFoundException
      */
     public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
-        super(mark + " " + e.getMessage(), e.getCause());
+        super(mark + " " + e.getMessage(), e);
     }
 }
diff --git a/java/org/apache/jasper/el/JspPropertyNotFoundException.java 
b/java/org/apache/jasper/el/JspPropertyNotFoundException.java
index 9abc59bd14..80f7f04a49 100644
--- a/java/org/apache/jasper/el/JspPropertyNotFoundException.java
+++ b/java/org/apache/jasper/el/JspPropertyNotFoundException.java
@@ -32,7 +32,7 @@ public final class JspPropertyNotFoundException extends 
PropertyNotFoundExceptio
      * @param e The cause exception
      */
     public JspPropertyNotFoundException(String mark, PropertyNotFoundException 
e) {
-        super(mark + " " + e.getMessage(), e.getCause());
+        super(mark + " " + e.getMessage(), e);
     }
 
 }
diff --git a/java/org/apache/jasper/el/JspPropertyNotWritableException.java 
b/java/org/apache/jasper/el/JspPropertyNotWritableException.java
index e1e39fd892..9c99f7b91b 100644
--- a/java/org/apache/jasper/el/JspPropertyNotWritableException.java
+++ b/java/org/apache/jasper/el/JspPropertyNotWritableException.java
@@ -32,6 +32,6 @@ public class JspPropertyNotWritableException extends 
PropertyNotWritableExceptio
      * @param e The cause exception
      */
     public JspPropertyNotWritableException(String mark, 
PropertyNotWritableException e) {
-        super(mark + " " + e.getMessage(), e.getCause());
+        super(mark + " " + e.getMessage(), e);
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to