On 24/10/2014 21:48, Mark Thomas wrote: > On 24/10/2014 21:22, Konstantin Kolinko wrote: >> 2014-10-24 23:48 GMT+04:00 <ma...@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?) > > Indeed. Worth looking at the history and the specs though first in case > there is a good reason for this.
It dates back to Tomcat 3.3.x, possibly earlier but I don't know my way around the code well enough that far back to trace it easily. >> java.io.Writer implements the same method so that it blows with an >> NPE. I think our implementation shall throw NPE as well. Works for me. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org