From 782c5014416920b4cfaf1f24a516b4436d8c72bf Mon Sep 17 00:00:00 2001 From: Jian Zhang <1361320460@qq.com> Date: Tue, 23 Apr 2024 19:11:51 +0800 Subject: [PATCH] HDFS-17451. RBF: fix spotbugs for redundant nullcheck of dns. (#6697) --- .../hdfs/server/federation/router/RouterRpcServer.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java index 865756514e..fe1323c4b5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java @@ -1089,13 +1089,7 @@ public DatanodeInfo[] getDatanodeReport(DatanodeReportType type) DatanodeInfo[] getCachedDatanodeReport(DatanodeReportType type) throws IOException { try { - DatanodeInfo[] dns = this.dnCache.get(type); - if (dns == null) { - LOG.debug("Get null DN report from cache"); - dns = getCachedDatanodeReportImpl(type); - this.dnCache.put(type, dns); - } - return dns; + return this.dnCache.get(type); } catch (ExecutionException e) { LOG.error("Cannot get the DN report for {}", type, e); Throwable cause = e.getCause();