You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/07/29 00:45:31 UTC
svn commit: r226274 -
/cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
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;
}