You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Vasu Mariyala (JIRA)" <ji...@apache.org> on 2013/09/04 02:17:52 UTC

[jira] [Created] (HBASE-9427) Copy constructor of ImmutableBytesWritable needs to consider the offset

Vasu Mariyala created HBASE-9427:
------------------------------------

             Summary: Copy constructor of ImmutableBytesWritable needs to consider the offset
                 Key: HBASE-9427
                 URL: https://issues.apache.org/jira/browse/HBASE-9427
             Project: HBase
          Issue Type: Bug
            Reporter: Vasu Mariyala


A simple test below
{code}
    byte[] bytes = {'a','b','c','d','e','f'};
    ImmutableBytesWritable writable1 = new ImmutableBytesWritable(bytes, 1, bytes.length);
    ImmutableBytesWritable writable2 = new ImmutableBytesWritable(writable1);
    Assert.assertTrue("Mismatch", writable1.equals(writable2));
{code}
would fail with AssertionFailedError.

The reason for this is 

{code}
  public ImmutableBytesWritable(final ImmutableBytesWritable ibw) {
    this(ibw.get(), 0, ibw.getSize());
  }
{code}

the constructor would always assume 0 as the offset while it can get it from ibw.getOffset() method.

--
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