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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 87446b9ef5 Fix regression in the fix for BZ 69333
87446b9ef5 is described below

commit 87446b9ef501dda4a552698b5c04cf97578cedc6
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 cff9b1f53e..08da12c135 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2110,6 +2110,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);
 
@@ -2289,13 +2293,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());
@@ -2308,6 +2314,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 61a03f4f64..e9f59a605d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -192,6 +192,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]

Reply via email to