hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/4] hbase git commit: HBASE-13892 NPE in ClientScanner on null results array
Date Fri, 12 Jun 2015 02:26:36 GMT
HBASE-13892 NPE in ClientScanner on null results array

Signed-off-by: Andrew Purtell <apurtell@apache.org>
Amending-Author: Andrew Purtell <apurtell@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/05cef0bb
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/05cef0bb
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/05cef0bb

Branch: refs/heads/branch-1.1
Commit: 05cef0bbdd87822b0862726c2d946588fe6e1698
Parents: 7125dd4
Author: Josh Elser <elserj@apache.org>
Authored: Thu Jun 11 20:33:19 2015 -0400
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Thu Jun 11 18:17:59 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/client/ClientScanner.java   |  3 ++-
 .../hadoop/hbase/client/TestFromClientSide.java     | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/05cef0bb/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
index 947eb69..d674534 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
@@ -573,7 +573,8 @@ public class ClientScanner extends AbstractClientScanner {
     // the caller will receive a result back where the number of cells in the result is less
than
     // the batch size even though it may not be the last group of cells for that row.
     if (allowPartials || isBatchSet) {
-      addResultsToList(resultsToAddToCache, resultsFromServer, 0, resultsFromServer.length);
+      addResultsToList(resultsToAddToCache, resultsFromServer, 0,
+          (null == resultsFromServer ? 0 : resultsFromServer.length));
       return resultsToAddToCache;
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/05cef0bb/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index 6381862..7a62873 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -72,6 +72,8 @@ import org.apache.hadoop.hbase.filter.CompareFilter;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.filter.Filter;
 import org.apache.hadoop.hbase.filter.FilterList;
+import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
+import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
 import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
 import org.apache.hadoop.hbase.filter.LongComparator;
 import org.apache.hadoop.hbase.filter.PrefixFilter;
@@ -6415,4 +6417,18 @@ public class TestFromClientSide {
       }
     }
   }
+
+  @Test
+  public void testFilterAllRecords() throws IOException {
+    Scan scan = new Scan();
+    scan.setBatch(1);
+    scan.setCaching(1);
+    // Filter out any records
+    scan.setFilter(new FilterList(new FirstKeyOnlyFilter(), new InclusiveStopFilter(new byte[0])));
+    try (Table table = TEST_UTIL.getConnection().getTable(TableName.NAMESPACE_TABLE_NAME))
{
+      try (ResultScanner s = table.getScanner(scan)) {
+        assertNull(s.next());
+      }
+    }
+  }
 }


Mime
View raw message