HBASE-19811 Fix findbugs and error-prone warnings in hbase-server (branch-2) - addendum

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Peter Somogyi 2018-01-29 14:47:24 +01:00 committed by Michael Stack
parent 0b9a0dc951
commit 34c6c99041
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
4 changed files with 8 additions and 18 deletions

View File

@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
@ -713,16 +712,6 @@ class MemStoreFlusher implements FlushRequester {
public int compareTo(Delayed o) { public int compareTo(Delayed o) {
return -1; return -1;
} }
@Override
public int hashCode() {
return System.identityHashCode(this);
}
@Override
public boolean equals(Object obj) {
return Objects.equals(this, obj);
}
} }
/** /**

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.procedure; package org.apache.hadoop.hbase.procedure;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf; import static org.mockito.Matchers.anyListOf;
import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq;
@ -250,7 +251,7 @@ public class TestZKProcedure {
Subprocedure r = ((Subprocedure) invocation.getMock()); Subprocedure r = ((Subprocedure) invocation.getMock());
LOG.error("Remote commit failure, not propagating error:" + remoteCause); LOG.error("Remote commit failure, not propagating error:" + remoteCause);
comms.receiveAbortProcedure(r.getName(), 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 // don't complete the error phase until the coordinator has gotten the error
// notification (which ensures that we never progress past prepare) // notification (which ensures that we never progress past prepare)
try { try {

View File

@ -2206,8 +2206,7 @@ public class TestHRegion {
} catch (Exception e) { } catch (Exception e) {
ok = true; ok = true;
} }
assertEquals("Family " + new String(family, StandardCharsets.UTF_8) + " does exist", assertTrue("Family " + new String(family, StandardCharsets.UTF_8) + " does exist", ok);
true, ok);
} finally { } finally {
HBaseTestingUtility.closeRegionAndWAL(this.region); HBaseTestingUtility.closeRegionAndWAL(this.region);
this.region = null; this.region = null;

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.zookeeper; package org.apache.hadoop.hbase.zookeeper;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
@ -286,7 +287,7 @@ public class TestZooKeeperACL {
saslConfFile.getAbsolutePath()); saslConfFile.getAbsolutePath());
testJaasConfig = ZKUtil.isSecureZooKeeper(new Configuration(TEST_UTIL.getConfiguration())); testJaasConfig = ZKUtil.isSecureZooKeeper(new Configuration(TEST_UTIL.getConfiguration()));
assertEquals(false, testJaasConfig); assertFalse(testJaasConfig);
saslConfFile.delete(); saslConfFile.delete();
} }
@ -300,13 +301,13 @@ public class TestZooKeeperACL {
Configuration config = new Configuration(HBaseConfiguration.create()); Configuration config = new Configuration(HBaseConfiguration.create());
boolean testJaasConfig = ZKUtil.isSecureZooKeeper(config); boolean testJaasConfig = ZKUtil.isSecureZooKeeper(config);
assertEquals(false, testJaasConfig); assertFalse(testJaasConfig);
// Now set authentication scheme to Kerberos still it should return false // Now set authentication scheme to Kerberos still it should return false
// because no configuration set // because no configuration set
config.set("hbase.security.authentication", "kerberos"); config.set("hbase.security.authentication", "kerberos");
testJaasConfig = ZKUtil.isSecureZooKeeper(config); testJaasConfig = ZKUtil.isSecureZooKeeper(config);
assertEquals(false, testJaasConfig); assertFalse(testJaasConfig);
// Now set programmatic options related to security // Now set programmatic options related to security
config.set(HConstants.ZK_CLIENT_KEYTAB_FILE, "/dummy/file"); 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_KEYTAB_FILE, "/dummy/file");
config.set(HConstants.ZK_SERVER_KERBEROS_PRINCIPAL, "dummy"); config.set(HConstants.ZK_SERVER_KERBEROS_PRINCIPAL, "dummy");
testJaasConfig = ZKUtil.isSecureZooKeeper(config); testJaasConfig = ZKUtil.isSecureZooKeeper(config);
assertEquals(true, testJaasConfig); assertTrue(testJaasConfig);
} }
private static class DummySecurityConfiguration extends javax.security.auth.login.Configuration { private static class DummySecurityConfiguration extends javax.security.auth.login.Configuration {