You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2021/07/01 15:00:34 UTC

[hbase] branch branch-2 updated: HBASE-26035 Redundant null check in the compareTo function (#3433)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 1f1e621  HBASE-26035 Redundant null check in the compareTo function (#3433)
1f1e621 is described below

commit 1f1e6219a550bc6e52f399dfb2b6fc2e3f77ea25
Author: Almog Tavor <70...@users.noreply.github.com>
AuthorDate: Thu Jul 1 17:56:14 2021 +0300

    HBASE-26035 Redundant null check in the compareTo function (#3433)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
index 5397496..09d600f 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
@@ -180,13 +180,7 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
     if (!(source instanceof MetricsRegionSourceImpl)) {
       return -1;
     }
-
-    MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source;
-    if (impl == null) {
-      return -1;
-    }
-
-    return Long.compare(hashCode, impl.hashCode);
+    return Long.compare(hashCode, ((MetricsRegionSourceImpl) source).hashCode);
   }
 
   void snapshot(MetricsRecordBuilder mrb, boolean ignored) {