hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [4/4] hbase git commit: HBASE-13892 NPE in ClientScanner on null results array
Date Fri, 12 Jun 2015 02:26:37 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/8cef99e5
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8cef99e5
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8cef99e5

Branch: refs/heads/master
Commit: 8cef99e5062d889a748c8442595a0e0644e11458
Parents: 9d3422e
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 19:03: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/8cef99e5/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 566bf4b..c013a4d 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
@@ -586,7 +586,8 @@ public abstract 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/8cef99e5/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 5ca2b92..027a348 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
@@ -73,6 +73,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;
@@ -6320,4 +6322,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