This is an automated email from the ASF dual-hosted git repository.
jsedding pushed a commit to branch jsedding/SLING-12421-JspServletWrapper-race
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-jsp.git
commit fda89fa4eb1169d0f3c8e27844b5e5565e0df3bd
Author: Julian Sedding <(none)>
AuthorDate: Mon Sep 16 14:47:19 2024 +0200
SLING-12421 - Race between serving request and destroying JspServletWrapper
---
.../scripting/jsp/jasper/servlet/JspServletWrapper.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git
a/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
b/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
index 49640f0..7134b3a 100644
---
a/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
+++
b/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
@@ -457,7 +457,7 @@ public class JspServletWrapper {
* @throws SlingPageException JSP page exception handler exceptions
* @throws SlingException for any non runtime exception
* @throws RuntimeException for runtime exceptions
- *
+ *
*/
public void service(final SlingBindings bindings) {
try {
@@ -594,7 +594,6 @@ public class JspServletWrapper {
e.getMessage()), e);
}
}
- theServlet = null;
}
}
}
@@ -604,7 +603,7 @@ public class JspServletWrapper {
return (RuntimeException) e;
}
// wrap in ScriptEvaluationException
- return new ScriptEvaluationException(this.ctxt.getJspFile(),
+ return new ScriptEvaluationException(this.ctxt.getJspFile(),
e.getMessage() == null ? e.toString() : e.getMessage(), e);
}
@@ -645,7 +644,7 @@ public class JspServletWrapper {
null,
javaLineNumber,
ctxt);
-
+
// If the line number is less than one we couldn't find out
// where in the JSP things went wrong
final int jspLineNumber = detail.getJspBeginLineNumber();
@@ -655,13 +654,13 @@ public class JspServletWrapper {
if (options.getDisplaySourceFragment() &&
detail.getJspExtract() != null ) {
message = Localizer.getMessage("jsp.exception",
detail.getJspFileName(), String.valueOf(jspLineNumber))
.concat(" :
").concat(origMsg).concat("\n\n").concat(detail.getJspExtract()).concat("\n");
-
+
} else {
message = Localizer.getMessage("jsp.exception",
detail.getJspFileName(), String.valueOf(jspLineNumber))
.concat(" : ").concat(origMsg);
- }
- result = new SlingException(message, ex);
- }
+ }
+ result = new SlingException(message, ex);
+ }
}
} catch (final Exception je) {
// If anything goes wrong, just revert to the original behaviour