From ae3ef7c3ff375e3401fa323e73842067bb7e19b3 Mon Sep 17 00:00:00 2001 From: "Jain, Nihal" Date: Thu, 21 Dec 2023 19:50:09 +0530 Subject: [PATCH] Fix findbug and rubocop warnings --- bin/draining_servers.rb | 2 +- bin/get-active-master.rb | 2 +- bin/replication/copy_tables_desc.rb | 2 +- bin/shutdown_regionserver.rb | 2 +- .../hadoop/hbase/logging/InternalLog4jUtils.java | 1 - hbase-shell/src/main/ruby/jar-bootstrap.rb | 8 ++++---- hbase-shell/src/test/ruby/no_cluster_tests_runner.rb | 11 ++++++----- hbase-shell/src/test/ruby/tests_runner.rb | 11 ++++++----- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/bin/draining_servers.rb b/bin/draining_servers.rb index 2da10a228b56..95707b064b8b 100644 --- a/bin/draining_servers.rb +++ b/bin/draining_servers.rb @@ -136,7 +136,7 @@ def listServers(_options) hostOrServers = ARGV[1..ARGV.size] # disable debug/info logging on this script for clarity -log_level = "ERROR" +log_level = 'ERROR' org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop', log_level) diff --git a/bin/get-active-master.rb b/bin/get-active-master.rb index cb55f4a351c5..65e0c3cd0fe0 100644 --- a/bin/get-active-master.rb +++ b/bin/get-active-master.rb @@ -24,7 +24,7 @@ java_import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker # disable debug/info logging on this script for clarity -log_level = "ERROR" +log_level = 'ERROR' org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop', log_level) diff --git a/bin/replication/copy_tables_desc.rb b/bin/replication/copy_tables_desc.rb index e0cba7f242c3..39bed5423c71 100644 --- a/bin/replication/copy_tables_desc.rb +++ b/bin/replication/copy_tables_desc.rb @@ -60,7 +60,7 @@ def copy(src, dst, table) end # disable debug/info logging on this script for clarity -log_level = "ERROR" +log_level = 'ERROR' org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop', log_level) diff --git a/bin/shutdown_regionserver.rb b/bin/shutdown_regionserver.rb index a7ee65fe78fe..d8ddb2a8625d 100644 --- a/bin/shutdown_regionserver.rb +++ b/bin/shutdown_regionserver.rb @@ -35,7 +35,7 @@ def usage(msg = nil) end # disable debug/info logging on this script for clarity -log_level = "ERROR" +log_level = 'ERROR' org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop', log_level) diff --git a/hbase-logging/src/main/java/org/apache/hadoop/hbase/logging/InternalLog4jUtils.java b/hbase-logging/src/main/java/org/apache/hadoop/hbase/logging/InternalLog4jUtils.java index 2ee67acc85b3..8dff80cf61b9 100644 --- a/hbase-logging/src/main/java/org/apache/hadoop/hbase/logging/InternalLog4jUtils.java +++ b/hbase-logging/src/main/java/org/apache/hadoop/hbase/logging/InternalLog4jUtils.java @@ -47,7 +47,6 @@ private static org.apache.logging.log4j.Level getLevel(String levelName) } static void setAllLevels(String loggerName, String levelName) { - org.apache.logging.log4j.Level level = getLevel(levelName); org.apache.logging.log4j.core.config.Configurator.setAllLevels(loggerName, getLevel(levelName)); } diff --git a/hbase-shell/src/main/ruby/jar-bootstrap.rb b/hbase-shell/src/main/ruby/jar-bootstrap.rb index ed1bc31a82dc..ed8f9b3a3a29 100644 --- a/hbase-shell/src/main/ruby/jar-bootstrap.rb +++ b/hbase-shell/src/main/ruby/jar-bootstrap.rb @@ -104,7 +104,7 @@ def add_to_configuration(c, arg) opts.ordering = GetoptLong::REQUIRE_ORDER script2run = nil -log_level = "ERROR" +log_level = 'ERROR' @shell_debug = false interactive = true full_backtrace = false @@ -118,7 +118,7 @@ def add_to_configuration(c, arg) when D_ARG conf_from_cli = add_to_configuration(conf_from_cli, arg) when '--debug' - log_level = "DEBUG" + log_level = 'DEBUG' full_backtrace = true @shell_debug = true puts 'Setting DEBUG log level...' @@ -165,11 +165,11 @@ def debug if @shell_debug @shell_debug = false conf.back_trace_limit = 0 - log_level = "ERROR" + log_level = 'ERROR' else @shell_debug = true conf.back_trace_limit = 100 - log_level = "DEBUG" + log_level = 'DEBUG' end org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop', log_level) diff --git a/hbase-shell/src/test/ruby/no_cluster_tests_runner.rb b/hbase-shell/src/test/ruby/no_cluster_tests_runner.rb index e4a241381352..0d2f1901438f 100644 --- a/hbase-shell/src/test/ruby/no_cluster_tests_runner.rb +++ b/hbase-shell/src/test/ruby/no_cluster_tests_runner.rb @@ -28,12 +28,13 @@ include Java # Set logging level to avoid verboseness - log_level = "OFF" + log_level = 'OFF' org.apache.hadoop.hbase.logging.Log4jUtils.setRootLevel(log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.zookeeper", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.hdfs", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.hbase", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.ipc.HBaseServer", log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hdfs', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils + .setAllLevels('org.apache.hadoop.ipc.HBaseServer', log_level) java_import org.apache.hadoop.hbase.HBaseTestingUtility diff --git a/hbase-shell/src/test/ruby/tests_runner.rb b/hbase-shell/src/test/ruby/tests_runner.rb index cb75cf86ab0b..e05d11117e58 100644 --- a/hbase-shell/src/test/ruby/tests_runner.rb +++ b/hbase-shell/src/test/ruby/tests_runner.rb @@ -27,12 +27,13 @@ include Java # Set logging level to avoid verboseness - log_level = "OFF" + log_level = 'OFF' org.apache.hadoop.hbase.logging.Log4jUtils.setRootLevel(log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.zookeeper", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.hdfs", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.hbase", log_level) - org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels("org.apache.hadoop.ipc.HBaseServer", log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.zookeeper', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hdfs', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils.setAllLevels('org.apache.hadoop.hbase', log_level) + org.apache.hadoop.hbase.logging.Log4jUtils + .setAllLevels('org.apache.hadoop.ipc.HBaseServer', log_level) java_import org.apache.hadoop.hbase.HBaseTestingUtility