cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r226274 - /cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Date Thu, 28 Jul 2005 22:45:31 GMT
Author: vgritsenko
Date: Thu Jul 28 15:45:26 2005
New Revision: 226274

URL: http://svn.apache.org/viewcvs?rev=226274&view=rev
Log:
fix bug in output stream handling.
exposed by r179249, could be seen in errorhandler samples.

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java?rev=226274&r1=226273&r2=226274&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java Thu Jul 28
15:45:26 2005
@@ -225,14 +225,24 @@
      */
     public OutputStream getOutputStream(int bufferSize)
     throws IOException {
+
+        // This method could be called several times during request processing
+        // with differing values of bufferSize and should handle this situation
+        // correctly.
+
         if (bufferSize == -1) {
             if (this.secureOutputStream == null) {
                 this.secureOutputStream = new BufferedOutputStream(this.outputStream);
             }
             return this.secureOutputStream;
         } else if (bufferSize == 0) {
+            // Discard secure output stream if it was created before.
+            if (this.secureOutputStream != null) {
+                this.secureOutputStream = null;
+            }
             return this.outputStream;
         } else {
+            // FIXME Triple buffering, anyone?
             this.outputStream = new java.io.BufferedOutputStream(this.outputStream, bufferSize);
             return this.outputStream;
         }



Mime
View raw message