Author: jboynes
Date: Wed Oct  2 15:48:37 2013
New Revision: 1528526

URL: http://svn.apache.org/r1528526
Log:
Apply patch from Dan Armstrong for bug #55608 <fmt:bundle> tag unnecessarily 
buffers body content

This change prevents double buffering by returning EVAL_BODY_INCLUDE so the 
content is written directly to the JSP writer's buffer rather than being held 
in an unbounded buffer in bodyContent until doEndTag(). This reduces memory 
consumption especially with large bodies. As a consequence of this change, the 
body content may now be flushed before the end of the tag thereby committing 
the response. Users relying on the buffering side-effect to recover from 
Exceptions raised in the body should now handle them explicitly.

Modified:
    
tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
    tomcat/taglibs/standard/trunk/jstlel/pom.xml

Modified: 
tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java?rev=1528526&r1=1528525&r2=1528526&view=diff
==============================================================================
--- 
tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
 (original)
+++ 
tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
 Wed Oct  2 15:48:37 2013
@@ -95,20 +95,7 @@ public abstract class BundleSupport exte
     @Override
     public int doStartTag() throws JspException {
         locCtxt = getLocalizationContext(pageContext, basename);
-        return EVAL_BODY_BUFFERED;
-    }
-
-    @Override
-    public int doEndTag() throws JspException {
-        if (bodyContent != null) {
-            try {
-                pageContext.getOut().print(bodyContent.getString());
-            } catch (IOException ioe) {
-                throw new JspTagException(ioe.toString(), ioe);
-            }
-        }
-
-        return EVAL_PAGE;
+        return EVAL_BODY_INCLUDE;
     }
 
     // Releases any resources we may have (or inherit)

Modified: tomcat/taglibs/standard/trunk/jstlel/pom.xml
URL: 
http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/pom.xml?rev=1528526&r1=1528525&r2=1528526&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/pom.xml (original)
+++ tomcat/taglibs/standard/trunk/jstlel/pom.xml Wed Oct  2 15:48:37 2013
@@ -63,6 +63,7 @@
 
     <contributors>
         <contributor><name>Robert Goff</name></contributor>
+        <contributor><name>Dan Armstrong</name></contributor>
     </contributors>
 
     <dependencies>



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

Reply via email to