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

Yu Li commented on HBASE-16692:
-------------------------------

Wondering whether we could abstract this check to a function, so won't repeat 
the same codes in two places. And it's better to add some UT case covering this 
case.

And maybe below codes are simpler?:
{code}
    if ((l1 == 0) || (l2 == 0)) {
      if ((l1 == 0) && (l2 == 0)) {
        return true;
      } else {
        return false;
      }
    }
{code}

> Make ByteBufferUtils#equals more safe and correct
> -------------------------------------------------
>
>                 Key: HBASE-16692
>                 URL: https://issues.apache.org/jira/browse/HBASE-16692
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: binlijin
>            Assignee: binlijin
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16692-master.patch
>
>
> ByteBufferUtils.equals(HConstants.EMPTY_BYTE_BUFFER, 0, 0, 
> HConstants.EMPTY_BYTE_ARRAY, 0, 0) will throw 
> java.lang.ArrayIndexOutOfBoundsException: -1, i think it should return true.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to