This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 868d87dae6 Fix regression in the fix for BZ 69333
868d87dae6 is described below
commit 868d87dae644d21aa957bde5ba25d0d97f51931f
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jan 13 20:34:00 2026 +0000
Fix regression in the fix for BZ 69333
Tag reuse() / release() must always be in a finally block.
---
java/org/apache/jasper/compiler/Generator.java | 14 +++++++++++---
webapps/docs/changelog.xml | 9 +++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/jasper/compiler/Generator.java
b/java/org/apache/jasper/compiler/Generator.java
index 3e52a0fda1..eec7eecca7 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2325,6 +2325,10 @@ class Generator {
writeNewInstance(tagHandlerVar, tagHandlerClass);
}
+ // Wrap use of tag in try/finally to ensure clean-up takes place
+ out.printil("try {");
+ out.pushIndent();
+
// includes setting the context
generateSetters(n, tagHandlerVar, handlerInfo, false);
@@ -2504,13 +2508,15 @@ class Generator {
out.pushIndent();
out.printin(tagHandlerVar);
out.println(".doFinally();");
- }
-
- if (n.implementsTryCatchFinally()) {
out.popIndent();
out.printil("}");
}
+ // Ensure clean-up takes place
+ out.popIndent();
+ out.printil("} finally {");
+ out.pushIndent();
+
if (usePooling(n)) {
// Print tag reuse
out.printin(n.getTagHandlerPoolName());
@@ -2523,6 +2529,8 @@ class Generator {
out.print(tagHandlerVar);
out.println(", _jsp_getInstanceManager());");
}
+ out.popIndent();
+ out.printil("}");
// Declare and synchronize AT_END scripting variables (must do this
// outside the try/catch/finally block)
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index fb6609d55c..be5da91c85 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -190,6 +190,15 @@
</add>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>69333</bug>: Correct a regression in the previous fix for
+ <bug>69333</bug> and ensure that <code>reuse()</code> or
+ <code>release()</code> is always called for a tag. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Cluster">
<changelog>
<add>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]