commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@multitask.com.au
Subject Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient RequestOutputStream.java
Date Mon, 05 Aug 2002 14:49:00 GMT
Good catch....will get to it asap.... but it is 00:31 on Tuesday here :)
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers


jsdever wrote on 08/05/2002 11:39:56 PM:

> >
> >
> >   -        if (this.closed == false) {
> >   +        if (!closed) {
> >                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.isDebugEnabled()) {
> >   -                  wireLog.debug(">> byte 0 \\r\\n\\r\\n (final 
chunk)");
> >   -               }
> >   -            }
> >   -            super.close();
> >   +                if (useChunking) {
> >   +                    // Write the final chunk.
> >   +                    stream.write(ZERO, 0, ZERO.length);
> >   +                    stream.write(CRLF, 0, CRLF.length);
> >   +                    stream.write(ENDCHUNK, 0, ENDCHUNK.length);
> >   +                    wireLog.debug(">> byte 0 \\r\\n\\r\\n 
> (final chunk)");
> >   +                }
> >   +                super.close();
> >                } catch (IOException ioe) {
> >   -             log.debug("Unexpected exception caught when 
> closing output stream", ioe);
> >   +                log.debug("Unexpected exception caught when 
> closing output "
> >   +                    + " stream", ioe);
> >                    throw ioe;
> >                } finally {
> >                    this.closed = true;
> >
> 
> The close is done in the try block, but the closed=true is done in 
> the finally block.  Could lead to an unclosed
> stream bbut closed==true if the write throws.  close() should be in 
> the finally (will have to swallow an exception
> thrown on the close).
> 
> 
> --
> To unsubscribe, e-mail: 
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
<mailto:commons-dev-help@jakarta.apache.org>
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message