From 15fe3d3279e84d9db41b29b5f8ac7ece31490fc3 Mon Sep 17 00:00:00 2001 From: Yu Li Date: Thu, 1 Dec 2016 13:28:24 +0800 Subject: [PATCH] HBASE-17212 Should add null checker on table name in HTable and RegionServerCallable constructor (addendum) --- .../apache/hadoop/hbase/client/RegionServerCallable.java | 7 ++----- .../hadoop/hbase/client/TestRpcControllerFactory.java | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java index 96434f977c7..a8e17c6d943 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java @@ -78,9 +78,6 @@ public abstract class RegionServerCallable implements RetryingCallable RpcController rpcController) { super(); this.connection = connection; - if (tableName == null) { - throw new IllegalArgumentException("Given tableName is null"); - } this.tableName = tableName; this.row = row; this.rpcController = rpcController; @@ -208,8 +205,8 @@ public abstract class RegionServerCallable implements RetryingCallable public void prepare(final boolean reload) throws IOException { // check table state if this is a retry - if (reload && !tableName.equals(TableName.META_TABLE_NAME) && - getConnection().isTableDisabled(tableName)) { + if (reload && tableName != null && !tableName.equals(TableName.META_TABLE_NAME) + && getConnection().isTableDisabled(tableName)) { throw new TableNotEnabledException(tableName.getNameAsString() + " is disabled."); } try (RegionLocator regionLocator = connection.getRegionLocator(tableName)) { diff --git a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java index aac020db099..3fdd8cb8059 100644 --- a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java +++ b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java @@ -92,7 +92,7 @@ public class TestRpcControllerFactory { super.setPriority(tn); // ignore counts for system tables - it could change and we really only want to check on what // the client should change - if (!tn.isSystemTable()) { + if (tn != null && !tn.isSystemTable()) { TABLE_PRIORITY.incrementAndGet(); }