[ 
https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Kusnierz updated IO-480:
-----------------------------
    Description: 
The IOUtils#closeQuietly method in its javadoc suggests that ANY exceptions 
will be ignored. This is not the case, as the code only catches IOExceptions. 
As this example stack trace shows, it is possible for some InputStreams to 
throw NullPointerExceptions during close:

java.lang.NullPointerException: null
        at java.io.FilterInputStream.close(FilterInputStream.java:155) 
~[na:1.6.0_35]
        at 
sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
 ~[na:1.6.0_35]
        at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:281) 
~[commons-io-2.1.jar:2.1]
        at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:224) 
~[commons-io-2.1.jar:2.1]

Close quietly should do as advertised/suggested and catch all Exceptions.

  was:
The IOUtils#closeQuietly method in its javadoc suggests that ANY exceptions 
will be ignored. This is not the case, as the code only catches IOExceptions. 
As this example stack trace shows, it is possible for some InputStreams to 
through NullPointerExceptions during close:

java.lang.NullPointerException: null
        at java.io.FilterInputStream.close(FilterInputStream.java:155) 
~[na:1.6.0_35]
        at 
sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
 ~[na:1.6.0_35]
        at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:281) 
~[commons-io-2.1.jar:2.1]
        at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:224) 
~[commons-io-2.1.jar:2.1]

Close quietly should do as advertised/suggested and catch all Exceptions.


> IOUtils.closeQuietly can throw NullPointerException
> ---------------------------------------------------
>
>                 Key: IO-480
>                 URL: https://issues.apache.org/jira/browse/IO-480
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.4
>            Reporter: Matt Kusnierz
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> The IOUtils#closeQuietly method in its javadoc suggests that ANY exceptions 
> will be ignored. This is not the case, as the code only catches IOExceptions. 
> As this example stack trace shows, it is possible for some InputStreams to 
> throw NullPointerExceptions during close:
> java.lang.NullPointerException: null
>       at java.io.FilterInputStream.close(FilterInputStream.java:155) 
> ~[na:1.6.0_35]
>       at 
> sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(JarURLConnection.java:90)
>  ~[na:1.6.0_35]
>       at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:281) 
> ~[commons-io-2.1.jar:2.1]
>       at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:224) 
> ~[commons-io-2.1.jar:2.1]
> Close quietly should do as advertised/suggested and catch all Exceptions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to