From ca5d8c40b7e39260f919cb6205acc2a875a1f118 Mon Sep 17 00:00:00 2001 From: Chia-Ping Tsai Date: Tue, 27 Jun 2017 10:17:41 +0800 Subject: [PATCH] HBASE-18268 Eliminate the findbugs warnings for hbase-client --- .../hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java | 5 +++-- .../java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java | 2 ++ .../apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 1 - .../src/main/java/org/apache/hadoop/hbase/util/PoolMap.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java index bb302dbc856..20706c69549 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java @@ -1091,12 +1091,13 @@ public class ColumnFamilyDescriptorBuilder { s.append(HConstants.METADATA).append(" => "); s.append('{'); boolean printComma = false; - for (Bytes k : values.keySet()) { + for (Map.Entry entry : values.entrySet()) { + Bytes k = entry.getKey(); if (RESERVED_KEYWORDS.contains(k)) { continue; } String key = Bytes.toString(k.get()); - String value = Bytes.toStringBinary(values.get(k).get()); + String value = Bytes.toStringBinary(entry.getValue().get()); if (printComma) { s.append(", "); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java index d414f7036bc..2acddda401c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java @@ -101,6 +101,8 @@ public abstract class AbstractRpcClient implements RpcC private static final ScheduledExecutorService IDLE_CONN_SWEEPER = Executors .newScheduledThreadPool(1, Threads.newDaemonThreadFactory("Idle-Rpc-Conn-Sweeper")); + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="MS_MUTABLE_COLLECTION_PKGPROTECT", + justification="the rest of the system which live in the different package can use") protected final static Map> TOKEN_HANDLERS = new HashMap<>(); static { diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index eebe4bdb12f..b1b52b1a95c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -3211,7 +3211,6 @@ public final class ProtobufUtil { for (ServerName serverName : status.getServers()) { LiveServerInfo.Builder lsi = LiveServerInfo.newBuilder().setServer(ProtobufUtil.toServerName(serverName)); - status.getLoad(serverName); lsi.setServerLoad(status.getLoad(serverName).obtainServerLoadPB()); builder.addLiveServers(lsi.build()); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java index 2131db359f4..40c6b55e534 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java @@ -210,7 +210,7 @@ public class PoolMap implements Map { } } } - return null; + return entries; } protected interface Pool {