You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Andrew Kyle Purtell (Jira)" <ji...@apache.org> on 2022/06/16 18:03:00 UTC

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

     [ https://issues.apache.org/jira/browse/HBASE-9427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kyle Purtell closed HBASE-9427.
--------------------------------------

> 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
>            Priority: Major
>
> 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 was sent by Atlassian Jira
(v8.20.7#820007)