[ 
https://issues.apache.org/jira/browse/HBASE-2463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858116#action_12858116
 ] 

ryan rawson commented on HBASE-2463:
------------------------------------

generally i would avoid putting in explicit NPE checks if they were going to 
fail 1 or 2 lines later. moar code is badddd


> Various Bytes.* functions silently ignore invalid arguments
> -----------------------------------------------------------
>
>                 Key: HBASE-2463
>                 URL: https://issues.apache.org/jira/browse/HBASE-2463
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: util
>            Reporter: Benoit Sigoure
>            Assignee: Benoit Sigoure
>
> Many functions in {{hbase.util.Bytes}} silently ignore invalid arguments.
> For instance, {{Bytes.toInt(null)}} deliberately returns {{-1}}.  There are 
> tons of cases like that.
> * All functions that are given a null pointer should throw an NPE.
> * All functions that are given otherwise invalid arguments should throw an 
> {{IllegalArgumentException}}.
> Anyone relying on "special return values" such as {{-1}} for 
> {{Bytes.toInt(null)}} is guilty of writing broken code ({{-1}} is a valid 
> return value for {{toInt}}!).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to