Repository: nifi Updated Branches: refs/heads/master 72ea93a65 -> f1e03b5ed
NIFI-5877 Protecting against null values when obtaining master address Signed-off-by: Pierre Villard <[email protected]> This closes #3206. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/f1e03b5e Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/f1e03b5e Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/f1e03b5e Branch: refs/heads/master Commit: f1e03b5ed5b53dd909f0e20d8684113120cd73e5 Parents: 72ea93a Author: Bryan Bende <[email protected]> Authored: Thu Dec 6 11:45:26 2018 -0500 Committer: Pierre Villard <[email protected]> Committed: Thu Dec 6 22:03:23 2018 +0100 ---------------------------------------------------------------------- .../nifi/hbase/HBase_1_1_2_ClientService.java | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/f1e03b5e/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java index 5d90470..050c8d0 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java +++ b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java @@ -20,7 +20,9 @@ import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; @@ -65,7 +67,6 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; @@ -262,7 +263,16 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme final Admin admin = this.connection.getAdmin(); if (admin != null) { admin.listTableNames(); - masterAddress = admin.getClusterStatus().getMaster().getHostAndPort(); + + final ClusterStatus clusterStatus = admin.getClusterStatus(); + if (clusterStatus != null) { + final ServerName master = clusterStatus.getMaster(); + if (master != null) { + masterAddress = master.getHostAndPort(); + } else { + masterAddress = null; + } + } } } } @@ -323,8 +333,6 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme } - private String principal = null; - protected Configuration getConfigurationFromFiles(final String configFiles) { final Configuration hbaseConfig = HBaseConfiguration.create(); if (StringUtils.isNotBlank(configFiles)) { @@ -346,16 +354,6 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme } } - private static final byte[] EMPTY_VIS_STRING; - - static { - try { - EMPTY_VIS_STRING = "".getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } - private List<Put> buildPuts(byte[] rowKey, List<PutColumn> columns) { List<Put> retVal = new ArrayList<>();
