tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1634125 - /tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
Date Fri, 24 Oct 2014 20:22:47 GMT
2014-10-24 23:48 GMT+04:00  <markt@apache.org>:
> Author: markt
> Date: Fri Oct 24 19:48:18 2014
> New Revision: 1634125
>
> URL: http://svn.apache.org/r1634125
> Log:
> Fix double counting of written characters.
>
> 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=1634125&r1=1634124&r2=1634125&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java Fri Oct 24 19:48:18
2014
> @@ -523,7 +523,6 @@ public class OutputBuffer extends Writer
>              return;
>          }
>
> -        charsWritten += len;
>          if (s == null) {
>              s = "null";
>          }

The context of the above change is

  @Override
  public void write(String s, int off, int len)
        throws IOException {

        if (suspended) {
            return;
        }

        if (s == null) {
            s = "null";
        }
        cb.append(s, off, len);
        charsWritten += len;
    }

The null value handling there is rather odd. It writes len character
from string "null". It makes no sense. (Whose offset and whose length
are those?)

java.io.Writer implements the same method so that it blows with an
NPE. I think our implementation shall throw NPE as well.

Best regards,
Konstantin Kolinko

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


Mime
View raw message