commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r674223 - /commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java
Date Sat, 05 Jul 2008 22:26:50 GMT
On 05/07/2008, sebb <sebbaz@gmail.com> wrote:
> On 05/07/2008, bayard@apache.org <bayard@apache.org> wrote:
>  > Author: bayard
>  >  Date: Sat Jul  5 11:45:40 2008
>  >  New Revision: 674223
>  >
>  >  URL: http://svn.apache.org/viewvc?rev=674223&view=rev
>  >  Log:
>  >  Null protect the stream closing
>  >
>  >  Modified:
>  >     commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java
>  >
>  >  Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java
>  >  URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java?rev=674223&r1=674222&r2=674223&view=diff
>  >  ==============================================================================
>  >  --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java
(original)
>  >  +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java
Sat Jul  5 11:45:40 2008
>  >  @@ -61,8 +61,12 @@
>  >                         throw new CompressException("An IO Exception has occured",
e);
>  >                 } finally {
>  >                         try {
>  >  -                               tempFileOutputStream.close();
>  >  -                               outputStream.close();
>  >  +                if(tempFileOutputStream != null) {
>  >  +                               tempFileOutputStream.close();
>  >  +                }
>  >  +                if(outputStream != null) {
>  >  +                               outputStream.close();
>  >  +                }
>
>
> However, if the first close() throws an IOException, the second will
>  be skipped ;-)
>

Actually, Findbugs points out that outputStream is always null at that point ;-)

Looks like the method is incomplete.

>
>  >                         } catch (IOException e) {
>  >                                 throw new CompressException("An IO Exception occured
while closing the streams", e);
>  >                         }
>  >
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message