2016-11-03 18:37 GMT+02:00 Christopher Schultz <ch...@christopherschultz.net
>:
>
> Violetta,
>
> On 11/3/16 11:11 AM, violet...@apache.org wrote:
> > Author: violetagg
> > Date: Thu Nov  3 15:11:18 2016
> > New Revision: 1767903
> >
> > URL: http://svn.apache.org/viewvc?rev=1767903&view=rev
> > Log:
> > Set the buffer size if it is above the one specified when OutputBuffer
object was created.
> > This change resets the behavior to the one before r1758421.
> >
> > Modified:
> >     tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.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=1767903&r1=1767902&r2=1767903&view=diff
> >
==============================================================================
> > --- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
(original)
> > +++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
Thu Nov  3 15:11:18 2016
> > @@ -639,7 +639,7 @@ public class OutputBuffer extends Writer
> >
> >
> >      public void setBufferSize(int size) {
> > -        if (size != bb.capacity()) {
> > +        if (size > bb.capacity()) {
> >              bb = ByteBuffer.allocate(size);
> >              clear(bb);
> >          }
>
> Might this cause a problem with output buffers growing without bound?

This is an API that the application can call.
Servlet javadoc specifies:

"Sets the preferred buffer size for the body of the response. The servlet
container will use a buffer at least as large as the size requested. The
actual buffer size used can be found using getBufferSize."
https://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html#setBufferSize-int-

Regards,
Violeta

>
> -chris
>

Reply via email to