accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwa...@apache.org
Subject [accumulo] branch master updated: Fixed code quality issues found by lgtm.com (#967)
Date Thu, 21 Feb 2019 18:00:48 GMT
This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 7173ae2  Fixed code quality issues found by lgtm.com (#967)
7173ae2 is described below

commit 7173ae263c0e3929bc6ccd3039eb9e67eccf9e2e
Author: Mike Walch <mwalch@apache.org>
AuthorDate: Thu Feb 21 13:00:43 2019 -0500

    Fixed code quality issues found by lgtm.com (#967)
    
    * Fixed logging argument issues
    * Removed null checks where never null
---
 .../java/org/apache/accumulo/fate/zookeeper/ZooLock.java  |  5 ++---
 .../master/balancer/HostRegexTableLoadBalancer.java       |  2 +-
 .../org/apache/accumulo/gc/SimpleGarbageCollector.java    |  4 ++--
 .../src/main/java/org/apache/accumulo/master/Master.java  |  2 +-
 .../replication/RemoveCompleteReplicationRecords.java     | 15 +++++----------
 .../java/org/apache/accumulo/master/tableOps/Utils.java   |  2 +-
 .../java/org/apache/accumulo/tserver/TabletServer.java    |  2 +-
 .../tserver/replication/ReplicationProcessor.java         |  2 +-
 shell/src/main/java/org/apache/accumulo/shell/Shell.java  |  3 +--
 9 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
index db71de3..0468b83 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
@@ -399,9 +399,8 @@ public class ZooLock implements Watcher {
       } catch (Exception ex) {
         if (lock != null || asyncLock != null) {
           lockWatcher.unableToMonitorLockNode(ex);
-          log.error(
-              "Error resetting watch on ZooLock " + lock == null ? asyncLock : lock + " "
+ event,
-              ex);
+          log.error("Error resetting watch on ZooLock {} {}", lock != null ? lock : asyncLock,
+              event, ex);
         }
       }
 
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
index 2f0cd8b..1916784 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
@@ -412,7 +412,7 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer implements
Con
                 }
               }
             } catch (TException e1) {
-              LOG.error("Error in OOB check getting tablets for table {} from server {}",
tid,
+              LOG.error("Error in OOB check getting tablets for table {} from server {} {}",
tid,
                   e.getKey().host(), e);
             }
           }
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
index 41f2540..d5fc10f 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
@@ -161,7 +161,7 @@ public class SimpleGarbageCollector implements Iface {
     log.info("time delay: {} milliseconds", gcDelay);
     log.info("safemode: {}", opts.safeMode);
     log.info("verbose: {}", opts.verbose);
-    log.info("memory threshold: {} of bytes", CANDIDATE_MEMORY_PERCENTAGE,
+    log.info("memory threshold: {} of {} bytes", CANDIDATE_MEMORY_PERCENTAGE,
         Runtime.getRuntime().maxMemory());
     log.info("delete threads: {}", getNumDeleteThreads());
   }
@@ -368,7 +368,7 @@ public class SimpleGarbageCollector implements Iface {
                 // uses suffixes to compare delete entries, there is no danger
                 // of deleting something that should not be deleted. Must not change value
of delete
                 // variable because thats whats stored in metadata table.
-                log.debug("Volume replaced {} -> ", delete, switchedDelete);
+                log.debug("Volume replaced {} -> {}", delete, switchedDelete);
                 fullPath = fs.getFullPath(FileType.TABLE, switchedDelete);
               } else {
                 fullPath = fs.getFullPath(FileType.TABLE, delete);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index e366c04..1bd4c2b 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1299,7 +1299,7 @@ public class Master
     zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
       @Override
       public void process(WatchedEvent event) {
-        nextEvent.event("Noticed recovery changes", event.getType());
+        nextEvent.event("Noticed recovery changes %s", event.getType());
         try {
           // watcher only fires once, add it back
           zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, this);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/RemoveCompleteReplicationRecords.java
b/server/master/src/main/java/org/apache/accumulo/master/replication/RemoveCompleteReplicationRecords.java
index 9fe182a..c51f2bd 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/RemoveCompleteReplicationRecords.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/RemoveCompleteReplicationRecords.java
@@ -92,17 +92,12 @@ public class RemoveCompleteReplicationRecords implements Runnable {
       sw.start();
       recordsRemoved = removeCompleteRecords(client, bs, bw);
     } finally {
-      if (bs != null) {
-        bs.close();
-      }
-      if (bw != null) {
-        try {
-          bw.close();
-        } catch (MutationsRejectedException e) {
-          log.error("Error writing mutations to {}, will retry", ReplicationTable.NAME, e);
-        }
+      bs.close();
+      try {
+        bw.close();
+      } catch (MutationsRejectedException e) {
+        log.error("Error writing mutations to {}, will retry", ReplicationTable.NAME, e);
       }
-
       sw.stop();
     }
 
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
index 61c3488..5c7a117 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
@@ -104,7 +104,7 @@ public class Utils {
 
   public static void unreserveTable(Master env, TableId tableId, long tid, boolean writeLock)
{
     getLock(env.getContext(), tableId, tid, writeLock).unlock();
-    log.info("table {} ({}) unlocked for ", tableId, Long.toHexString(tid),
+    log.info("table {} ({}) unlocked for {}", tableId, Long.toHexString(tid),
         (writeLock ? "write" : "read"));
   }
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 23b54b8..57f63e2 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -3116,7 +3116,7 @@ public class TabletServer implements Runnable {
     }
 
     if (future == null) {
-      log.info("The master has not assigned {} to ", extent, instance);
+      log.info("The master has not assigned {} to {}", extent, instance);
       return null;
     }
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationProcessor.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationProcessor.java
index 9758c04..e415805 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationProcessor.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationProcessor.java
@@ -103,7 +103,7 @@ public class ReplicationProcessor implements Processor {
       log.error("Could not look for replication record", e);
       throw new IllegalStateException("Could not look for replication record", e);
     } catch (InvalidProtocolBufferException e) {
-      log.error("Could not deserialize Status from Work section for {} and ", file, target);
+      log.error("Could not deserialize Status from Work section for {} and {}", file, target);
       throw new RuntimeException("Could not parse Status for work record", e);
     } catch (NoSuchElementException e) {
       log.error("Assigned work for {} to {} but could not find work record", file, target);
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 58aeac4..92d84c4 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -779,8 +779,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
           ++exitCode;
           printException(e);
         }
-        if (sc != null)
-          sc.printHelp(this);
+        sc.printHelp(this);
       } catch (UserInterruptException e) {
         ++exitCode;
       } catch (Exception e) {


Mime
View raw message