From 1c28633fbae7f900453c80af5e5e1ecafe8221b5 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-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java index 40df2eef63d..2f7f8074c9d 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java +++ b/hbase-hadoop-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) {