Skip to content

Commit

Permalink
HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281
Browse files Browse the repository at this point in the history
)

HBASE-22520 Avoid possible NPE while performing seekBefore in HalfStoreFileReader
  • Loading branch information
virajjasani authored and apurtell committed Jun 20, 2019
1 parent bc737d1 commit 183aae3
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -60,9 +60,9 @@ public class HalfStoreFileReader extends StoreFileReader {
// i.e. empty column and a timestamp of LATEST_TIMESTAMP.
protected final byte [] splitkey;

protected final Cell splitCell;
private final Cell splitCell;

private Optional<Cell> firstKey = null;
private Optional<Cell> firstKey = Optional.empty();

private boolean firstKeySeeked = false;

Expand Down Expand Up @@ -269,7 +269,8 @@ public int reseekTo(Cell key) throws IOException {
public boolean seekBefore(Cell key) throws IOException {
if (top) {
Optional<Cell> fk = getFirstKey();
if (PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key, fk.get()) <= 0) {
if (fk.isPresent() &&
PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key, fk.get()) <= 0) {
return false;
}
} else {
Expand Down

0 comments on commit 183aae3

Please sign in to comment.