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 2018/12/14 00:14:36 UTC

[08/50] [abbrv] hbase git commit: Amend HBASE-18830 TestCanaryTool does not check Canary monitor's error code

Amend HBASE-18830 TestCanaryTool does not check Canary monitor's error code

Adjust exception control flow to fix findbugs warning
NP_NULL_ON_SOME_PATH_EXCEPTION, Possible null pointer dereference of
regionSink in org.apache.hadoop.hbase.tool.Canary$RegionMonitor.run()
on exception path


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

Branch: refs/heads/branch-1.3
Commit: 5d0d3aa2b962a27a7eb33b20ef91476893380b89
Parents: e72ed4f
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue Sep 26 08:33:19 2017 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Wed Dec 12 18:08:16 2018 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/tool/Canary.java | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5d0d3aa2/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
index c7323fe..dcaa057 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
@@ -1022,19 +1022,14 @@ public final class Canary implements Tool {
       if (this.initAdmin()) {
         try {
           List<Future<Void>> taskFutures = new LinkedList<>();
-          RegionStdOutSink regionSink = null;
-          try {
-            regionSink = this.getSink();
-          } catch (RuntimeException e) {
-            LOG.error("Run RegionMonitor failed!", e);
-            this.errorCode = ERROR_EXIT_CODE;
-          }
+          RegionStdOutSink regionSink = this.getSink();
           if (this.targets != null && this.targets.length > 0) {
             String[] tables = generateMonitorTables(this.targets);
             // Check to see that each table name passed in the -readTableTimeouts argument is also passed as a monitor target.
             if (! new HashSet<>(Arrays.asList(tables)).containsAll(this.configuredReadTableTimeouts.keySet())) {
               LOG.error("-readTableTimeouts can only specify read timeouts for monitor targets passed via command line.");
               this.errorCode = USAGE_EXIT_CODE;
+              return;
             }
             this.initialized = true;
             for (String table : tables) {
@@ -1096,7 +1091,9 @@ public final class Canary implements Tool {
         } catch (Exception e) {
           LOG.error("Run regionMonitor failed", e);
           this.errorCode = ERROR_EXIT_CODE;
-        }
+        } finally {
+          this.done = true;
+	}
       }
       this.done = true;
     }