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

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

commit 3428bfa6a47ecaa0581acf37f85770cfd3f1d320
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 4394956d4f..6a28b9ef73 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 b0947f226e..32614f666c 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 72c8ec150b..3bd7c655ec 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 788b74680c..85185f9e34 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