[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15390241#comment-15390241 ] ASF GitHub Bot commented on IO-480: --- Github user rajivpjs closed the pull request at: https://github.com/apache/commons-io/pull/14 > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380652#comment-15380652 ] ASF GitHub Bot commented on IO-480: --- GitHub user rajivpjs opened a pull request: https://github.com/apache/commons-io/pull/14 [IO-480] Removed the deprectaed method closeQuietly from the Java doc… As the closeQuietly method has been deprecated, I thought I would use this ticket IO-480 to remove the Java documentation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/rajivpjs/commons-io IO-480 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-io/pull/14.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #14 commit 2c801149cbb6fabcef569ac301e9933b169a5fac Author: Rajiv Jain Date: 2016-07-16T09:27:03Z [IO-480] Removed the deprectaed method closeQuietly from the Java documentation > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14578580#comment-14578580 ] Matt Kusnierz commented on IO-480: -- If the intended use of this method is to perform a best efforts attempt to close the inputStream and not to worry about exceptions; doesn't it make sense to simply catch Exceptions instead of just IOExceptions. I agree that in this case the NullPointerException should not be thrown in the first place; so the core java FilterInputStream; and/or the JarURLConnectopm$JarUrlInputStream sub-class is at fault; but there could be any number of other poor inputStream implementations out there; and closing them quietly is still the goal of this utility method. Otherwise the user may be forced to re-wrap the call to closeQuietly with another try-catch; which makes closeQuietly redundant. > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14577732#comment-14577732 ] Sebb commented on IO-480: - I think a better fix might be to correct the Javadoc. > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14577000#comment-14577000 ] Matt Kusnierz commented on IO-480: -- I have tried to raise this with Oracle through my support companies support contract; and they appear to be reluctant to fix this in the FilterInputStream. The closeQuietly method says that it should silently swallow ANY / all exceptions; so I still think that it makes sense to fix this within IOUtils. > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14573794#comment-14573794 ] Sebb commented on IO-480: - That seems like a bug in the InputStream implementation. Does not seem right to catch Exceptions that are not supposed to be thrown by close(), so I suggest closing this as won't fix > 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)
[jira] [Commented] (IO-480) IOUtils.closeQuietly can throw NullPointerException
[ https://issues.apache.org/jira/browse/IO-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14567280#comment-14567280 ] Matt Kusnierz commented on IO-480: -- Also tried with v2.4 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:303) ~[commons-io-2.4.jar:2.4] at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:246) ~[commons-io-2.4.jar:2.4] > 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)