You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Benoit Sigoure (JIRA)" <ji...@apache.org> on 2010/04/17 10:57:24 UTC

[jira] Created: (HBASE-2463) Various Bytes.* functions silently ignore invalid arguments

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