hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doğacan Güney (JIRA) <j...@apache.org>
Subject [jira] Commented: (HBASE-892) Cell iteration is broken
Date Mon, 22 Sep 2008 20:53:44 GMT

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

Doğacan Güney commented on HBASE-892:

Hi Jim,

Thanks for the comments.

About applying patch: I develop on git, so you have to apply my patches with -p1. I guess
I should migrate to svn to make things easier  :)

This code throws on exception without this patch for me:


    byte[][] vals = Bytes.toByteArrays(new String[] { "cell", "iteration", "testing"});
    long now = System.currentTimeMillis();
    long[] ts = {now, now + 10, now + 20};
    Cell cell = new Cell(vals, ts);

    Iterator<Cell> it = cell.iterator();
    while (it.hasNext()) {
      Cell c = it.next();


Assume currentValue == values.length - 1. We first call hasNext and since currentValue is
less than values.length it returns true. Now, during next(), we increase currentValue by one
thus making it values.length. So attempting to access values[values.length] causes an exception.

> Cell iteration is broken
> ------------------------
>                 Key: HBASE-892
>                 URL: https://issues.apache.org/jira/browse/HBASE-892
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: io
>    Affects Versions: 0.19.0
>            Reporter: Doğacan Güney
>            Priority: Minor
>         Attachments: cell.patch
> Cell implements Iterable<Cell> but its iteration is broken since it will always
go one past the edge and throw an ArrayIndexOutOfBoundsException

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message