From f3f63407468f69d45945adc4b61e7fb06944ec84 Mon Sep 17 00:00:00 2001 From: ConfX <114765570+teamconfx@users.noreply.github.com> Date: Thu, 28 Mar 2024 23:09:50 +0800 Subject: [PATCH] HDFS-17443. add null check for fileSys and cluster before shutting down (#6683) --- .../hadoop/hdfs/server/namenode/TestNameEditsConfigs.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameEditsConfigs.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameEditsConfigs.java index 7071c661f3..1dc13d1b9d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameEditsConfigs.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameEditsConfigs.java @@ -447,8 +447,12 @@ public void testNameEditsConfigsFailure() throws IOException { replication, SEED); checkFile(fileSys, file1, replication); } finally { - fileSys.close(); - cluster.shutdown(); + if (fileSys != null) { + fileSys.close(); + } + if (cluster != null) { + cluster.shutdown(); + } } // 2