You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2019/06/20 22:13:28 UTC
[hbase] branch branch-2.2 updated: HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281)
This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 1904929 HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281)
1904929 is described below
commit 19049293dbd94a2d9455b5b70d0947cf46c70900
Author: virajjasani <34...@users.noreply.github.com>
AuthorDate: Fri Jun 7 04:13:36 2019 +0530
HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281)
HBASE-22520 Avoid possible NPE while performing seekBefore in HalfStoreFileReader
---
.../main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
index 2e112c1..11ab068 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
@@ -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;
@@ -269,7 +269,8 @@ public class HalfStoreFileReader extends StoreFileReader {
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 {