BatchScanner iterator implementation erroneously returns true for hasNext upon
subsequent hasNext calls
-------------------------------------------------------------------------------------------------------
Key: ACCUMULO-226
URL: https://issues.apache.org/jira/browse/ACCUMULO-226
Project: Accumulo
Issue Type: Bug
Components: client
Affects Versions: 1.5.0
Environment: Platform independent
Reporter: Matthew Kirkley
Assignee: Billie Rinaldi
Fix For: 1.5.0
If you open a batch scanner and iterate through its contents, after hasNext has
returned false, subsequent calls to hasNext will return true. Below is a
testcase which shows the issue.
Connector conn = new Connector(new
ZooKeeperInstance("accumulo","localhost"),"root","password".getBytes());
BatchScanner scanner = conn.createBatchScanner("test",
Constants.NO_AUTHS, 1);
scanner.setRanges(Collections.singletonList(new Range()));
//exhaust the iterator
Iterator it = scanner.iterator();
while (it.hasNext()){
it.next();
}
assertFalse("hasNext should be false", it.hasNext());
I found this issue when wrapping a BatchScanner in a IteratorChain which
subsequently seems to call hasNext twice in it's hasNext method. I will attach
a patch which resolves the issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira