freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [2/4] incubator-freemarker git commit: Bug fixed: For JSP Tag based custom tags, if an exception has occurred in the body (nested content), an IndexOutOfBoundsException might have occurred, replacing the original exception.
Date Sun, 04 Feb 2018 12:10:06 GMT
Bug fixed: For JSP Tag based custom tags, if an exception has occurred in the body (nested
content), an IndexOutOfBoundsException might have occurred, replacing the original exception.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/db7c6d54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/db7c6d54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/db7c6d54

Branch: refs/heads/2.3
Commit: db7c6d5470b66af743ef1600aca4168852540e2e
Parents: 2856144
Author: ddekany <ddekany@apache.org>
Authored: Sun Feb 4 12:53:27 2018 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Sun Feb 4 12:53:27 2018 +0100

----------------------------------------------------------------------
 .../freemarker/ext/jsp/TagTransformModel.java   | 28 +++++++++++++-------
 src/manual/en_US/book.xml                       | 14 +++++++---
 2 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/db7c6d54/src/main/java/freemarker/ext/jsp/TagTransformModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/jsp/TagTransformModel.java b/src/main/java/freemarker/ext/jsp/TagTransformModel.java
index bc0fda3..0190948 100644
--- a/src/main/java/freemarker/ext/jsp/TagTransformModel.java
+++ b/src/main/java/freemarker/ext/jsp/TagTransformModel.java
@@ -292,6 +292,7 @@ class TagTransformModel extends JspTagModelBase implements TemplateTransformMode
         private final FreeMarkerPageContext pageContext;
         private boolean needPop = true;
         private final boolean needDoublePop;
+        private boolean colosed = false;
         
         TagWriter(Writer out, Tag tag, FreeMarkerPageContext pageContext, boolean needDoublePop)
{
             super((JspWriter) out, false);
@@ -393,20 +394,27 @@ class TagTransformModel extends JspTagModelBase implements TemplateTransformMode
         
         @Override
         public void close() {
-            if (needPop) {
-                pageContext.popWriter();
+            if (colosed) {
+                return;
             }
-            pageContext.popTopTag();
             try {
-                if (isTryCatchFinally) {
-                    ((TryCatchFinally) tag).doFinally();
-                }
-                // No pooling yet
-                tag.release();
-            } finally {
-                if (needDoublePop) {
+                if (needPop) {
                     pageContext.popWriter();
                 }
+                pageContext.popTopTag();
+                try {
+                    if (isTryCatchFinally) {
+                        ((TryCatchFinally) tag).doFinally();
+                    }
+                    // No pooling yet
+                    tag.release();
+                } finally {
+                    if (needDoublePop) {
+                        pageContext.popWriter();
+                    }
+                }
+            } finally {
+                colosed = true;
             }
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/db7c6d54/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 91c5893..b208ecd 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -27123,7 +27123,7 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
             </listitem>
 
             <listitem>
-              <para>Improved exception handling when calling JSP tags:</para>
+              <para>Fixes in exception handling when calling JSP tags:</para>
 
               <itemizedlist>
                 <listitem>
@@ -27131,14 +27131,22 @@ TemplateModel x = env.getVariable("x");  // get variable x</programlisting>
                   xlink:href="https://issues.apache.org/jira/browse/FREEMARKER-88">FREEMARKER-88</link>):
                   If a <literal>TemplateException</literal> that's not a
                   <literal>TemplateModelExceptoin</literal> has occurred in
-                  the body of a JSP <literal>SimpleTag</literal> (typically,
-                  an <literal>InvalidReferenceException</literal>), that has
+                  the body (nested content) of a JSP
+                  <literal>SimpleTag</literal> (typically, an
+                  <literal>InvalidReferenceException</literal>), that has
                   caused a <literal>ClassCastException</literal> in the
                   exception handling code, thus the template processing has
                   thrown that instead of the original exception.</para>
                 </listitem>
 
                 <listitem>
+                  <para>Bug fixed: For JSP Tag based custom tags, if an
+                  exception has occurred in the body (nested content), an
+                  <literal>IndexOutOfBoundsException</literal> might have
+                  occurred, replacing the original exception.</para>
+                </listitem>
+
+                <listitem>
                   <para>Wrapping of
                   non-<literal>TemplateModelException</literal>
                   <literal>TemplateException</literal>-s (typically


Mime
View raw message