[ https://issues.apache.org/jira/browse/IO-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15440749#comment-15440749 ]
Behrang Saeedzadeh commented on IO-513: --------------------------------------- Hi Gary, Thanks for your feedback. I think that NPE scenario is handled by these lines in {{resourceToURL}}: {code} final URL resource = IOUtils.class.getResource(name); if (resource == null) { throw new IOException("Resource not found: " + name); } {code} Also other overloads delegate to {{resourceURL}} so they are covered too. Or is there another potential for {{NPE}} that I am missing? Regarding the best place for this method, I don't mind to move these methods if a better place in the Commons is suggested, but {{IOUtils}} already has these methods (and more) that deal with network IO: * https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/IOUtils.html#closeQuietly(java.net.Socket) * https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/IOUtils.html#closeQuietly(java.net.ServerSocket) * https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/IOUtils.html#toByteArray(java.net.URL) * https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/IOUtils.html#toByteArray(java.net.URI) So probably {{IOUtils}} is not a bad place for these {{resourceTo...}} methods after all. Regards, Behrang > Add convenience methods for reading class path resources > -------------------------------------------------------- > > Key: IO-513 > URL: https://issues.apache.org/jira/browse/IO-513 > Project: Commons IO > Issue Type: New Feature > Components: Utilities > Reporter: Behrang Saeedzadeh > Priority: Minor > Labels: beginner, features, github-import, newbie > > Add convenience methods to {{IOUtils}} for reading class path resources and > returning them as {{String}}, {{byte[]}}, and {{URL}} respectively. > Github PR: https://github.com/apache/commons-io/pull/17 -- This message was sent by Atlassian JIRA (v6.3.4#6332)