Author: markt
Date: Tue Jun  7 14:00:16 2011
New Revision: 1133014

URL: http://svn.apache.org/viewvc?rev=1133014&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51324
Improve handling of exceptions when flushing the response buffer to ensure that 
the doFlush flag does not get stuck in the enabled state.
Patch provided by Jeremy Norris.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java?rev=1133014&r1=1133013&r2=1133014&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java Tue Jun  
7 14:00:16 2011
@@ -228,6 +228,7 @@ public class OutputBuffer extends Writer
         
         bb.recycle(); 
         closed = false;
+        doFlush = false;
         suspended = false;
         
         if (conv!= null) {
@@ -310,15 +311,18 @@ public class OutputBuffer extends Writer
         if (suspended)
             return;
 
-        doFlush = true;
-        if (initial) {
-            coyoteResponse.sendHeaders();
-            initial = false;
-        }
-        if (bb.getLength() > 0) {
-            bb.flushBuffer();
+        try {
+            doFlush = true;
+            if (initial) {
+                coyoteResponse.sendHeaders();
+                initial = false;
+            }
+            if (bb.getLength() > 0) {
+                bb.flushBuffer();
+            }
+        } finally {
+            doFlush = false;
         }
-        doFlush = false;
 
         if (realFlush) {
             coyoteResponse.action(ActionCode.CLIENT_FLUSH, 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1133014&r1=1133013&r2=1133014&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jun  7 14:00:16 2011
@@ -43,6 +43,15 @@
   Other
 -->
 <section name="Tomcat 7.0.16 (markt)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        <bug>51324</bug>: Improve handling of exceptions when flushing the
+        response buffer to ensure that the doFlush flag does not get stuck in
+        the enabled state. Patch provided by Jeremy Norris. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Coyote">
     <changelog>
       <fix>



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

Reply via email to