tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1548498 - in /tomcat/trunk/java/org/apache: catalina/connector/OutputBuffer.java tomcat/util/buf/ByteChunk.java
Date Fri, 06 Dec 2013 12:12:16 GMT
Author: markt
Date: Fri Dec  6 12:12:15 2013
New Revision: 1548498

URL: http://svn.apache.org/r1548498
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55842
Check if the output buffer can grow before flushing it when using a writer.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
    tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java

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=1548498&r1=1548497&r2=1548498&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java Fri Dec  6 12:12:15
2013
@@ -467,7 +467,12 @@ public class OutputBuffer extends Writer
                 break;
             }
             if (outputCharChunk.getLength() > 0) {
-                bb.flushBuffer();
+                if (bb.getBuffer().length == bb.getEnd() && bb.getLength() < bb.getLimit())
{
+                    // Need to expand output buffer
+                    bb.makeSpace(outputCharChunk.getLength());
+                } else {
+                    bb.flushBuffer();
+                }
             }
         }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=1548498&r1=1548497&r2=1548498&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Fri Dec  6 12:12:15 2013
@@ -427,11 +427,11 @@ public final class ByteChunk implements 
         end=start;
     }
 
-    /** Make space for len chars. If len is small, allocate
-     *        a reserve space too. Never grow bigger than limit.
+    /**
+     * Make space for len chars. If len is small, allocate a reserve space too.
+     * Never grow bigger than limit.
      */
-    private void makeSpace(int count)
-    {
+    public void makeSpace(int count) {
         byte[] tmp = null;
 
         int newSize;



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


Mime
View raw message