You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2017/01/27 18:35:02 UTC

svn commit: r1780601 - in /tomcat/trunk: java/org/apache/jasper/compiler/Generator.java test/webapp/WEB-INF/tags/bug42390.tag test/webapp/bug48nnn/bug48616b.jsp webapps/docs/changelog.xml

Author: remm
Date: Fri Jan 27 18:35:02 2017
New Revision: 1780601

URL: http://svn.apache.org/viewvc?rev=1780601&view=rev
Log:
Improve the error handling for simple tags to ensure that the tag is released and destroyed once used (v2 with Violeta).

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
    tomcat/trunk/test/webapp/WEB-INF/tags/bug42390.tag
    tomcat/trunk/test/webapp/bug48nnn/bug48616b.jsp
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Generator.java?rev=1780601&r1=1780600&r2=1780601&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Fri Jan 27 18:35:02 2017
@@ -2640,9 +2640,15 @@ class Generator {
             declareScriptingVars(n, VariableInfo.AT_BEGIN);
             saveScriptingVars(n, VariableInfo.AT_BEGIN);
 
+            // Declare AT_END scripting variables
+            declareScriptingVars(n, VariableInfo.AT_END);
+
             String tagHandlerClassName = tagHandlerClass.getCanonicalName();
             writeNewInstance(tagHandlerVar, tagHandlerClassName);
 
+            out.printil("try {");
+            out.pushIndent();
+
             generateSetters(n, tagHandlerVar, handlerInfo, true);
 
             // Set the body
@@ -2682,13 +2688,19 @@ class Generator {
             // Synchronize AT_BEGIN scripting variables
             syncScriptingVars(n, VariableInfo.AT_BEGIN);
 
-            // Declare and synchronize AT_END scripting variables
-            declareScriptingVars(n, VariableInfo.AT_END);
+            // Synchronize AT_END scripting variables
             syncScriptingVars(n, VariableInfo.AT_END);
 
+            out.popIndent();
+            out.printil("} finally {");
+            out.pushIndent();
+
             // Resource injection
             writeDestroyInstance(tagHandlerVar);
 
+            out.popIndent();
+            out.printil("}");
+
             n.setEndJavaLine(out.getJavaLine());
         }
 

Modified: tomcat/trunk/test/webapp/WEB-INF/tags/bug42390.tag
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/WEB-INF/tags/bug42390.tag?rev=1780601&r1=1780600&r2=1780601&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/WEB-INF/tags/bug42390.tag (original)
+++ tomcat/trunk/test/webapp/WEB-INF/tags/bug42390.tag Fri Jan 27 18:35:02 2017
@@ -14,5 +14,5 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 --%>
-<%@ variable name-given="X" scope="AT_BEGIN" %>
+<%@ variable name-given="X" scope="AT_END" %>
 <jsp:doBody/>
\ No newline at end of file

Modified: tomcat/trunk/test/webapp/bug48nnn/bug48616b.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug48nnn/bug48616b.jsp?rev=1780601&r1=1780600&r2=1780601&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/bug48nnn/bug48616b.jsp (original)
+++ tomcat/trunk/test/webapp/bug48nnn/bug48616b.jsp Fri Jan 27 18:35:02 2017
@@ -26,3 +26,6 @@
     <bugs:Bug48616b />
   </bugs:Bug46816a>
 </tags:bug42390>
+<%
+  out.println(X);
+%>

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1780601&r1=1780600&r2=1780601&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Jan 27 18:35:02 2017
@@ -94,6 +94,10 @@
         Refactor code generated for JSPs to reduce the size of the code required
         for tags. (markt)
       </fix>
+      <fix>
+        Improve the error handling for simple tags to ensure that the tag is
+        released and destroyed once used. (remm, violetagg)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org