-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TISPARK-45] Fix ScanIterator logic where index may be out of bound #357
Conversation
/run-all-tests |
@@ -115,8 +115,7 @@ public boolean hasNext() { | |||
if (!loadCache()) { | |||
endOfRegion = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should return false here. Since endOfRegion is true, hasNext should be false. @ilovesoup
@@ -115,8 +115,7 @@ public boolean hasNext() { | |||
if (!loadCache()) { | |||
endOfRegion = true; | |||
} | |||
} | |||
if (!contains(currentCache.get(index).getKey())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here if index is not initialized, it will remain -1
so IndexOutOfBoundsException will be thrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In previous implementation, if
index
is not initialized,IndexOutOfBoundsException
would be thrown.