Author: billbarker
Date: Thu Feb 16 19:08:58 2006
New Revision: 378420

URL: http://svn.apache.org/viewcvs?rev=378420&view=rev
Log:
Fix NPE when now sink is supplied.

Previously, you could hit this by having maxSavePostSize=4K, and POSTing more 
than 4K worth of data to a protected page with FORM auth.  Now the code throws 
an IOE farther down, which is handled correctly by FormAuthenticator.


Modified:
    tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java
    tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java

Modified: 
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=378420&r1=378419&r2=378420&view=diff
==============================================================================
--- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java 
(original)
+++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java 
Thu Feb 16 19:08:58 2006
@@ -320,7 +320,7 @@
         // If the buffer is empty and the source is going to fill up all the
         // space in buffer, may as well write it directly to the output,
         // and avoid an extra copy
-        if ( optimizedWrite && len == limit && end == start) {
+        if ( optimizedWrite && len == limit && end == start && out != null ) {
             out.realWriteBytes( src, off, len );
             return;
         }

Modified: 
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java?rev=378420&r1=378419&r2=378420&view=diff
==============================================================================
--- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java 
(original)
+++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java 
Thu Feb 16 19:08:58 2006
@@ -255,7 +255,7 @@
         // Optimize on a common case.
         // If the source is going to fill up all the space in buffer, may
         // as well write it directly to the output, and avoid an extra copy
-        if ( optimizedWrite && len == limit && end == start) {
+        if ( optimizedWrite && len == limit && end == start && out != null ) {
             out.realWriteChars( src, off, len );
             return;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to