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

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

commit ca341f1cdd582bd6b08c02050d1781c201dbc31b
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 5141c1cfa1..b035649e21 100644
--- a/java/org/apache/jasper/el/JspELException.java
+++ b/java/org/apache/jasper/el/JspELException.java
@@ -35,6 +35,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 7bc0727adb..a70fa90144 100644
--- a/java/org/apache/jasper/el/JspMethodNotFoundException.java
+++ b/java/org/apache/jasper/el/JspMethodNotFoundException.java
@@ -35,6 +35,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 eed6126534..442674946e 100644
--- a/java/org/apache/jasper/el/JspPropertyNotFoundException.java
+++ b/java/org/apache/jasper/el/JspPropertyNotFoundException.java
@@ -35,7 +35,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 b5f467a11e..f0bee31c93 100644
--- a/java/org/apache/jasper/el/JspPropertyNotWritableException.java
+++ b/java/org/apache/jasper/el/JspPropertyNotWritableException.java
@@ -35,6 +35,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