From ee7f15a675eda7c1e0993f06926e81f8dc515742 Mon Sep 17 00:00:00 2001 From: Almog Tavor <70065337+almogtavor@users.noreply.github.com> Date: Thu, 1 Jul 2021 17:56:14 +0300 Subject: [PATCH] HBASE-26035 Redundant null check in the compareTo function (#3433) Signed-off-by: Duo Zhang --- .../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 5397496bf83..09d600f26ff 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) {