HBASE-19811 Fix findbugs and error-prone warnings in hbase-server (branch-2) - addendum
Signed-off-by: Michael Stack <st...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/34c6c990 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/34c6c990 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/34c6c990 Branch: refs/heads/HBASE-19064 Commit: 34c6c99041d5f4a217363667b090fb1b5beb7abe Parents: 0b9a0dc Author: Peter Somogyi <psomo...@cloudera.com> Authored: Mon Jan 29 14:47:24 2018 +0100 Committer: Michael Stack <st...@apache.org> Committed: Mon Jan 29 14:03:08 2018 -0800 ---------------------------------------------------------------------- .../hadoop/hbase/regionserver/MemStoreFlusher.java | 11 ----------- .../apache/hadoop/hbase/procedure/TestZKProcedure.java | 3 ++- .../apache/hadoop/hbase/regionserver/TestHRegion.java | 3 +-- .../apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java | 9 +++++---- 4 files changed, 8 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/34c6c990/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java index f7493b0..d7c7c5a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.SortedMap; import java.util.concurrent.BlockingQueue; @@ -713,16 +712,6 @@ class MemStoreFlusher implements FlushRequester { public int compareTo(Delayed o) { return -1; } - - @Override - public int hashCode() { - return System.identityHashCode(this); - } - - @Override - public boolean equals(Object obj) { - return Objects.equals(this, obj); - } } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/34c6c990/hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestZKProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestZKProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestZKProcedure.java index 7438bb7..1b0fc9f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestZKProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestZKProcedure.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hbase.procedure; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyListOf; import static org.mockito.Matchers.eq; @@ -250,7 +251,7 @@ public class TestZKProcedure { Subprocedure r = ((Subprocedure) invocation.getMock()); LOG.error("Remote commit failure, not propagating error:" + remoteCause); comms.receiveAbortProcedure(r.getName(), remoteCause); - assertEquals(true, r.isComplete()); + assertTrue(r.isComplete()); // don't complete the error phase until the coordinator has gotten the error // notification (which ensures that we never progress past prepare) try { http://git-wip-us.apache.org/repos/asf/hbase/blob/34c6c990/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java index e443503..04dcb92 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java @@ -2206,8 +2206,7 @@ public class TestHRegion { } catch (Exception e) { ok = true; } - assertEquals("Family " + new String(family, StandardCharsets.UTF_8) + " does exist", - true, ok); + assertTrue("Family " + new String(family, StandardCharsets.UTF_8) + " does exist", ok); } finally { HBaseTestingUtility.closeRegionAndWAL(this.region); this.region = null; http://git-wip-us.apache.org/repos/asf/hbase/blob/34c6c990/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java index d668466..0580cda 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hbase.zookeeper; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.File; @@ -286,7 +287,7 @@ public class TestZooKeeperACL { saslConfFile.getAbsolutePath()); testJaasConfig = ZKUtil.isSecureZooKeeper(new Configuration(TEST_UTIL.getConfiguration())); - assertEquals(false, testJaasConfig); + assertFalse(testJaasConfig); saslConfFile.delete(); } @@ -300,13 +301,13 @@ public class TestZooKeeperACL { Configuration config = new Configuration(HBaseConfiguration.create()); boolean testJaasConfig = ZKUtil.isSecureZooKeeper(config); - assertEquals(false, testJaasConfig); + assertFalse(testJaasConfig); // Now set authentication scheme to Kerberos still it should return false // because no configuration set config.set("hbase.security.authentication", "kerberos"); testJaasConfig = ZKUtil.isSecureZooKeeper(config); - assertEquals(false, testJaasConfig); + assertFalse(testJaasConfig); // Now set programmatic options related to security config.set(HConstants.ZK_CLIENT_KEYTAB_FILE, "/dummy/file"); @@ -314,7 +315,7 @@ public class TestZooKeeperACL { config.set(HConstants.ZK_SERVER_KEYTAB_FILE, "/dummy/file"); config.set(HConstants.ZK_SERVER_KERBEROS_PRINCIPAL, "dummy"); testJaasConfig = ZKUtil.isSecureZooKeeper(config); - assertEquals(true, testJaasConfig); + assertTrue(testJaasConfig); } private static class DummySecurityConfiguration extends javax.security.auth.login.Configuration {