dion 02/02/17 04:15:56
Modified: httpclient/src/java/org/apache/commons/httpclient
RequestOutputStream.java
Log:
Applied patches from Sean C. Sullivan about closing of streams not being
done correctly
Revision Changes Path
1.8 +23 -14
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java
Index: RequestOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RequestOutputStream.java 15 Feb 2002 06:17:14 -0000 1.7
+++ RequestOutputStream.java 17 Feb 2002 12:15:56 -0000 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
1.7 2002/02/15 06:17:14 dion Exp $
- * $Revision: 1.7 $
- * $Date: 2002/02/15 06:17:14 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
1.8 2002/02/17 12:15:56 dion Exp $
+ * $Revision: 1.8 $
+ * $Date: 2002/02/17 12:15:56 $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -74,9 +74,9 @@
* {@link OutputStream} wrapper supporting the chunked transfer encoding.
* </p>
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Sean C. Sullivan</a>
+ * @author Sean C. Sullivan
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
- * @version $Revision: 1.7 $ $Date: 2002/02/15 06:17:14 $
+ * @version $Revision: 1.8 $ $Date: 2002/02/17 12:15:56 $
*/
public class RequestOutputStream
extends OutputStream {
@@ -119,7 +119,7 @@
/**
- * The underlying input stream from which we should read data.
+ * The underlying output stream to which we will write data.
*/
private OutputStream stream = null;
@@ -274,16 +274,25 @@
*/
public void close() throws IOException {
- if (useChunking) {
- // Write the final chunk.
- stream.write(zero, 0, zero.length);
- stream.write(crlf, 0, crlf.length);
- stream.write(endChunk, 0, endChunk.length);
- if(wireLog.isInfoEnabled()) {
- wireLog.info(">> byte 0 \\r\\n\\r\\n (final chunk)");
+ if (this.closed == false) {
+ try {
+ if (useChunking) {
+ // Write the final chunk.
+ stream.write(zero, 0, zero.length);
+ stream.write(crlf, 0, crlf.length);
+ stream.write(endChunk, 0, endChunk.length);
+ if(wireLog.isInfoEnabled()) {
+ wireLog.info(">> byte 0 \\r\\n\\r\\n (final
chunk)");
+ }
+ }
+ super.close();
+ } catch (java.io.IOException ex) {
+ throw ex;
+ } finally {
+ this.closed = true;
}
}
- super.close();
+
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>