hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-18268 Eliminate the findbugs warnings for hbase-client
Date Tue, 11 Jul 2017 19:17:25 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 e0b858e72 -> a84de3312


HBASE-18268 Eliminate the findbugs warnings for hbase-client


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a84de331
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a84de331
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a84de331

Branch: refs/heads/branch-1.3
Commit: a84de33129054685c3b6c138bae79ea0e52f9479
Parents: e0b858e
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Wed Jul 12 03:16:58 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Wed Jul 12 03:16:58 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/HColumnDescriptor.java   | 10 ++++++----
 .../java/org/apache/hadoop/hbase/HTableDescriptor.java    |  8 ++++----
 .../java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java |  2 ++
 .../java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java   |  2 ++
 .../java/org/apache/hadoop/hbase/security/SaslUtil.java   |  2 ++
 .../main/java/org/apache/hadoop/hbase/util/PoolMap.java   |  2 +-
 6 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
index 32882c9..64366d4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
@@ -1176,13 +1176,14 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
     boolean hasConfigKeys = false;
 
     // print all reserved keys first
-    for (ImmutableBytesWritable k : values.keySet()) {
+    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet())
{
+      ImmutableBytesWritable k = entry.getKey();
       if (!RESERVED_KEYWORDS.contains(k)) {
         hasConfigKeys = true;
         continue;
       }
       String key = Bytes.toString(k.get());
-      String value = Bytes.toStringBinary(values.get(k).get());
+      String value = Bytes.toStringBinary(entry.getValue().get());
       if (printDefaults
           || !DEFAULT_VALUES.containsKey(key)
           || !DEFAULT_VALUES.get(key).equalsIgnoreCase(value)) {
@@ -1199,12 +1200,13 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
       s.append(HConstants.METADATA).append(" => ");
       s.append('{');
       boolean printComma = false;
-      for (ImmutableBytesWritable k : values.keySet()) {
+      for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet())
{
+        ImmutableBytesWritable 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(", ");
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
index 31a880a..2381a26 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
@@ -957,7 +957,8 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor>
{
     // step 1: set partitioning and pruning
     Set<ImmutableBytesWritable> reservedKeys = new TreeSet<ImmutableBytesWritable>();
     Set<ImmutableBytesWritable> userKeys = new TreeSet<ImmutableBytesWritable>();
-    for (ImmutableBytesWritable k : values.keySet()) {
+    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet())
{
+      ImmutableBytesWritable k = entry.getKey();
       if (k == null || k.get() == null) continue;
       String key = Bytes.toString(k.get());
       // in this section, print out reserved keywords + coprocessor info
@@ -966,7 +967,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor>
{
         continue;
       }
       // only print out IS_ROOT/IS_META if true
-      String value = Bytes.toString(values.get(k).get());
+      String value = Bytes.toString(entry.getValue().get());
       if (key.equalsIgnoreCase(IS_ROOT) || key.equalsIgnoreCase(IS_META)) {
         if (Boolean.valueOf(value) == false) continue;
       }
@@ -1174,8 +1175,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor>
{
       result = families.size() - other.families.size();
     }
     if (result == 0 && families.size() != other.families.size()) {
-      result = Integer.valueOf(families.size()).compareTo(
-          Integer.valueOf(other.families.size()));
+      result = Integer.compare(families.size(), other.families.size());
     }
     if (result == 0) {
       for (Iterator<HColumnDescriptor> it = families.values().iterator(),

http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
index 93063b8..b810708 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.java
@@ -86,6 +86,8 @@ public class AsyncRpcChannel {
 
   private static final int MAX_SASL_RETRIES = 5;
 
+  @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<Kind, TokenSelector<? extends TokenIdentifier>>
TOKEN_HANDDLERS
     = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java
index 68adfba..bc92c65 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java
@@ -119,6 +119,8 @@ public class RpcClientImpl extends AbstractRpcClient {
 
   protected final SocketFactory socketFactory;           // how to create sockets
 
+  @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<AuthenticationProtos.TokenIdentifier.Kind,
       TokenSelector<? extends TokenIdentifier>> tokenHandlers =
       new HashMap<AuthenticationProtos.TokenIdentifier.Kind,

http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
index 8033f7c..6c02ed5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
@@ -35,6 +35,8 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
 public class SaslUtil {
   private static final Log log = LogFactory.getLog(SaslUtil.class);
   public static final String SASL_DEFAULT_REALM = "default";
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="MS_MUTABLE_COLLECTION_PKGPROTECT",
+      justification="it is used in different package")
   public static final Map<String, String> SASL_PROPS =
       new TreeMap<String, String>();
   public static final int SWITCH_TO_SIMPLE_AUTH = -88;

http://git-wip-us.apache.org/repos/asf/hbase/blob/a84de331/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java
----------------------------------------------------------------------
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 9d0319b..0bb6d61 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
@@ -209,7 +209,7 @@ public class PoolMap<K, V> implements Map<K, V> {
         }
       }
     }
-    return null;
+    return entries;
   }
 
   protected interface Pool<R> {


Mime
View raw message