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

markt-asf 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 4297dc2ab1 Review "Avoid NullPointerException in include error path 
for non-JAR..."
4297dc2ab1 is described below

commit 4297dc2ab12e2b1b3470b5063efcb01a36da841f
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Nov 5 17:55:22 2026 +0000

    Review "Avoid NullPointerException in include error path for non-JAR..."
    
    Include root cause to aid debugging
---
 java/org/apache/jasper/compiler/Parser.java           | 3 ++-
 java/org/apache/jasper/compiler/ParserController.java | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Parser.java 
b/java/org/apache/jasper/compiler/Parser.java
index d7f780029e..7c6a1c7134 100644
--- a/java/org/apache/jasper/compiler/Parser.java
+++ b/java/org/apache/jasper/compiler/Parser.java
@@ -324,7 +324,8 @@ class Parser implements TagConstants {
         } catch (FileNotFoundException ex) {
             err.jspError(start, "jsp.error.file.not.found", file);
         } catch (Exception e) {
-            err.jspError(start, e.getMessage());
+            // Retain the exception as the cause so the original failure is 
not lost
+            err.jspError(start, e, e.getMessage());
         }
     }
 
diff --git a/java/org/apache/jasper/compiler/ParserController.java 
b/java/org/apache/jasper/compiler/ParserController.java
index e9852b73ff..3e34e3d815 100644
--- a/java/org/apache/jasper/compiler/ParserController.java
+++ b/java/org/apache/jasper/compiler/ParserController.java
@@ -199,7 +199,7 @@ public class ParserController implements TagConstants {
             absFileName = resolveFileName(inFileName);
         } catch (URISyntaxException e) {
             // Note: jar may be null here, so avoid referencing it
-            err.jspError("jsp.error.invalid.include", inFileName);
+            err.jspError(e, "jsp.error.invalid.include", inFileName);
         }
         if (processingTagInJar && 
!absFileName.startsWith(TAGS_IN_JAR_LOCATION)) {
             /*


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

Reply via email to