hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [6/7] hbase git commit: HBASE-15115 Fix findbugs complaints in hbase-client
Date Fri, 22 Jul 2016 01:16:02 GMT
HBASE-15115 Fix findbugs complaints in hbase-client


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

Branch: refs/heads/0.98
Commit: e5d0d4858070974a1d4b8a1110ad5f174a0faf68
Parents: 3ca0780
Author: stack <stack@apache.org>
Authored: Fri Jan 15 10:25:49 2016 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Thu Jul 21 17:56:05 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/MetricsConnection.java    | 2 +-
 .../hadoop/hbase/client/RetriesExhaustedException.java       | 3 +--
 .../java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java  | 8 ++------
 .../java/org/apache/hadoop/hbase/filter/LongComparator.java  | 2 --
 .../org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java  | 2 ++
 5 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e5d0d485/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
index f73356a..919895e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
@@ -103,7 +103,7 @@ public class MetricsConnection implements StatisticTrackable {
   }
 
   @VisibleForTesting
-  protected final class CallTracker {
+  protected static final class CallTracker {
     private final String name;
     @VisibleForTesting final Timer callTimer;
     @VisibleForTesting final Histogram reqHist;

http://git-wip-us.apache.org/repos/asf/hbase/blob/e5d0d485/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
index d4f1057..0c62cff 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
@@ -84,8 +84,7 @@ public class RetriesExhaustedException extends IOException {
   public RetriesExhaustedException(final int numTries,
                                    final List<ThrowableWithExtraContext> exceptions)
{
     super(getMessage(numTries, exceptions),
-        (exceptions != null && !exceptions.isEmpty() ?
-            exceptions.get(exceptions.size() - 1).t : null));
+      exceptions.isEmpty()? null: exceptions.get(exceptions.size() - 1).t);
   }
 
   private static String getMessage(String callableVitals, int numTries,

http://git-wip-us.apache.org/repos/asf/hbase/blob/e5d0d485/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
index a1245cd..cd8f908 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
@@ -194,12 +194,8 @@ public class FuzzyRowFilter extends FilterBase {
                 @Override
                 public int compare(Pair<byte[], Pair<byte[], byte[]>> o1,
                     Pair<byte[], Pair<byte[], byte[]>> o2) {
-                  int compare = Bytes.compareTo(o1.getFirst(), o2.getFirst());
-                  if (!isReversed()) {
-                    return compare;
-                  } else {
-                    return -compare;
-                  }
+                  return isReversed()? Bytes.compareTo(o2.getFirst(), o1.getFirst()):
+                    Bytes.compareTo(o1.getFirst(), o2.getFirst());
                 }
               });
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e5d0d485/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
index f05675a..5c8a3cb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
@@ -79,8 +79,6 @@ public class LongComparator extends ByteArrayComparable {
      */
     boolean areSerializedFieldsEqual(LongComparator other) {
         if (other == this) return true;
-        if (!(other instanceof LongComparator)) return false;
-
         return super.areSerializedFieldsEqual(other);
     }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e5d0d485/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
index 4bcf430..e556d5e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
@@ -499,6 +499,8 @@ public class MultiRowRangeFilter extends FilterBase {
     }
 
     @Override
+    @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="EQ_COMPARETO_USE_OBJECT_EQUALS",
+      justification="This compareTo is not of this Object, but of referenced RowRange")
     public int compareTo(RowRange other) {
       return Bytes.compareTo(this.startRow, other.startRow);
     }


Mime
View raw message