commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (IO-365) NullPointerException IOUtils
Date Fri, 01 Feb 2013 10:11:13 GMT

    [ https://issues.apache.org/jira/browse/IO-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13568055#comment-13568055
] 

Sebb edited comment on IO-365 at 2/1/13 10:10 AM:
--------------------------------------------------

A null parameter will generate a NullPointerException for most of the method parameters in
IOUtils.

Is it really worth checking for null and reporting IllegalArgumentException?

For most cases, the check will just be unnecessary, and it should be fairly obvious what the
cause of the problem is.

[later]
-However, it might be worth adding explicit Javadoc.- 
I've checked some Javadoc from the standard libraries, e.g. java.lang.String.
The code does not check for null and does not document the NPE.

-Patches welome.-
                
      was (Author: sebb@apache.org):
    A null parameter will generate a NullPointerException for most of the method parameters
in IOUtils.

Is it really worth checking for null and reporting IllegalArgumentException?

For most cases, the check will just be unnecessary, and it should be fairly obvious what the
cause of the problem is.

However, it might be worth adding explicit Javadoc.

Patches welome.
                  
> NullPointerException IOUtils
> ----------------------------
>
>                 Key: IO-365
>                 URL: https://issues.apache.org/jira/browse/IO-365
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.2
>            Reporter: Rustam Matusevic
>            Priority: Trivial
>
> This is normal way to do like this?
> {code}
>     public static InputStream toInputStream(String input) { // if i put null here?
>         byte[] bytes = input.getBytes();
>         return new ByteArrayInputStream(bytes);
>     }
> {code}
> You might to warn users of framework, you know throw some or handle it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message