File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
hbase-client/src/main/java/org/apache/hadoop/hbase/client
hbase-server/src/test/java/org/apache/hadoop/hbase/client Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -913,7 +913,7 @@ public CellScanner cellScanner() {
913
913
914
914
@ Override
915
915
public Cell current () {
916
- if (cells == null
916
+ if (isEmpty ()
917
917
|| cellScannerIndex == INITIAL_CELLSCANNER_INDEX
918
918
|| cellScannerIndex >= cells .length )
919
919
return null ;
@@ -922,7 +922,9 @@ public Cell current() {
922
922
923
923
@ Override
924
924
public boolean advance () {
925
- if (cells == null ) return false ;
925
+ if (isEmpty ()) {
926
+ return false ;
927
+ }
926
928
cellScannerIndex ++;
927
929
if (cellScannerIndex < this .cells .length ) {
928
930
return true ;
Original file line number Diff line number Diff line change @@ -125,14 +125,12 @@ public void testCurrentOnEmptyCell() throws IOException {
125
125
assertNull (r .current ());
126
126
}
127
127
128
- public void testAdvanceTwiceOnEmptyCell () throws IOException {
128
+ public void testAdvanceMultipleOnEmptyCell () throws IOException {
129
129
Result r = Result .create (new Cell [0 ]);
130
- assertFalse (r .advance ());
131
- try {
132
- r .advance ();
133
- fail ("NoSuchElementException should have been thrown!" );
134
- } catch (NoSuchElementException ex ) {
135
- LOG .debug ("As expected: " + ex .getMessage ());
130
+ // After HBASE-26688, advance of result with empty cell list will always return false.
131
+ // Here 10 is an arbitrary number to test the logic.
132
+ for (int i = 0 ; i < 10 ; i ++) {
133
+ assertFalse (r .advance ());
136
134
}
137
135
}
138
136
You can’t perform that action at this time.
0 commit comments