You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2013/11/25 11:23:16 UTC

svn commit: r1545211 - in /hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase: ./ client/ filter/ zookeeper/

Author: nkeywal
Date: Mon Nov 25 10:23:15 2013
New Revision: 1545211

URL: http://svn.apache.org/r1545211
Log:
HBASE-10011 Fix some findbugs in the client

Modified:
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
    hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java Mon Nov 25 10:23:15 2013
@@ -166,40 +166,40 @@ public class RegionLoad {
   @Override
   public String toString() {
     StringBuilder sb = Strings.appendKeyValue(new StringBuilder(), "numberOfStores",
-      Integer.valueOf(this.getStores()));
+        this.getStores());
     sb = Strings.appendKeyValue(sb, "numberOfStorefiles",
-      Integer.valueOf(this.getStorefiles()));
+        this.getStorefiles());
     sb = Strings.appendKeyValue(sb, "storefileUncompressedSizeMB",
-      Integer.valueOf(this.getStoreUncompressedSizeMB()));
+        this.getStoreUncompressedSizeMB());
     sb = Strings.appendKeyValue(sb, "storefileSizeMB",
-        Integer.valueOf(this.getStorefileSizeMB()));
+        this.getStorefileSizeMB());
     if (this.getStoreUncompressedSizeMB() != 0) {
       sb = Strings.appendKeyValue(sb, "compressionRatio",
-          String.format("%.4f", (float)this.getStorefileSizeMB()/
-              (float)this.getStoreUncompressedSizeMB()));
+          String.format("%.4f", (float) this.getStorefileSizeMB() /
+              (float) this.getStoreUncompressedSizeMB()));
     }
     sb = Strings.appendKeyValue(sb, "memstoreSizeMB",
-      Integer.valueOf(this.getMemStoreSizeMB()));
+        this.getMemStoreSizeMB());
     sb = Strings.appendKeyValue(sb, "storefileIndexSizeMB",
-      Integer.valueOf(this.getStorefileIndexSizeMB()));
+        this.getStorefileIndexSizeMB());
     sb = Strings.appendKeyValue(sb, "readRequestsCount",
-        Long.valueOf(this.getReadRequestsCount()));
+        this.getReadRequestsCount());
     sb = Strings.appendKeyValue(sb, "writeRequestsCount",
-        Long.valueOf(this.getWriteRequestsCount()));
+        this.getWriteRequestsCount());
     sb = Strings.appendKeyValue(sb, "rootIndexSizeKB",
-        Integer.valueOf(this.getRootIndexSizeKB()));
+        this.getRootIndexSizeKB());
     sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB",
-        Integer.valueOf(this.getTotalStaticIndexSizeKB()));
+        this.getTotalStaticIndexSizeKB());
     sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB",
-      Integer.valueOf(this.getTotalStaticBloomSizeKB()));
+        this.getTotalStaticBloomSizeKB());
     sb = Strings.appendKeyValue(sb, "totalCompactingKVs",
-        Long.valueOf(this.getTotalCompactingKVs()));
+        this.getTotalCompactingKVs());
     sb = Strings.appendKeyValue(sb, "currentCompactedKVs",
-        Long.valueOf(this.getCurrentCompactedKVs()));
+        this.getCurrentCompactedKVs());
     float compactionProgressPct = Float.NaN;
-    if( this.getTotalCompactingKVs() > 0 ) {
-      compactionProgressPct = Float.valueOf(
-          this.getCurrentCompactedKVs() / this.getTotalCompactingKVs());
+    if (this.getTotalCompactingKVs() > 0) {
+      compactionProgressPct = ((float) this.getCurrentCompactedKVs() /
+          (float) this.getTotalCompactingKVs());
     }
     sb = Strings.appendKeyValue(sb, "compactionProgressPct",
         compactionProgressPct);

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java Mon Nov 25 10:23:15 2013
@@ -463,6 +463,8 @@ public class HTableMultiplexer {
     }
 
     @Override
+    @edu.umd.cs.findbugs.annotations.SuppressWarnings
+        (value = "REC_CATCH_EXCEPTION", justification = "na")
     public void run() {
       List<PutStatus> processingList = new ArrayList<PutStatus>();
       /** 

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java Mon Nov 25 10:23:15 2013
@@ -125,7 +125,7 @@ public class Result implements CellScann
     if (exists != null){
       return new Result(null, exists);
     }
-    return new Result(cells.toArray(new Cell[cells.size()]), exists);
+    return new Result(cells.toArray(new Cell[cells.size()]), null);
   }
 
   /**

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java Mon Nov 25 10:23:15 2013
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -98,6 +99,11 @@ public class RowMutations implements Row
   }
 
   @Override
+  public int hashCode(){
+    return Arrays.hashCode(row);
+  }
+
+  @Override
   public byte[] getRow() {
     return row;
   }

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java Mon Nov 25 10:23:15 2013
@@ -44,6 +44,8 @@ import com.google.protobuf.ServiceExcept
  * Dynamic rather than static so can set the generic appropriately.
  */
 @InterfaceAudience.Private
+@edu.umd.cs.findbugs.annotations.SuppressWarnings
+    (value = "IS2_INCONSISTENT_SYNC", justification = "na")
 public class RpcRetryingCaller<T> {
   static final Log LOG = LogFactory.getLog(RpcRetryingCaller.class);
   /**
@@ -102,6 +104,8 @@ public class RpcRetryingCaller<T> {
    * @throws IOException if a remote or network exception occurs
    * @throws RuntimeException other unspecified error
    */
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings
+      (value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "na")
   public synchronized T callWithRetries(RetryingCallable<T> callable, int callTimeout)
   throws IOException, RuntimeException {
     this.callTimeout = callTimeout;

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java Mon Nov 25 10:23:15 2013
@@ -44,6 +44,7 @@ public class NullComparator extends Byte
   }
 
   @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings (value="EQ_UNUSUAL", justification="")
   public boolean equals(Object obj) {
     return obj == null;
   }

Modified: hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java?rev=1545211&r1=1545210&r2=1545211&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java (original)
+++ hbase/branches/0.96/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java Mon Nov 25 10:23:15 2013
@@ -1938,8 +1938,9 @@ public class ZKUtil {
     ZooKeeperProtos.StoreSequenceId.Builder storeSequenceIdBuilder =
         ZooKeeperProtos.StoreSequenceId.newBuilder();
     if (storeSequenceIds != null) {
-      for (byte[] columnFamilyName : storeSequenceIds.keySet()) {
-        Long curSeqId = storeSequenceIds.get(columnFamilyName);
+      for (Map.Entry<byte[], Long> e : storeSequenceIds.entrySet()){
+        byte[] columnFamilyName = e.getKey();
+        Long curSeqId = e.getValue();
         storeSequenceIdBuilder.setFamilyName(ZeroCopyLiteralByteString.wrap(columnFamilyName));
         storeSequenceIdBuilder.setSequenceId(curSeqId);
         regionSequenceIdsBuilder.addStoreSequenceId(storeSequenceIdBuilder.build());