diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 25da013fd6a..30a460fb1e2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -520,6 +520,8 @@ Release 2.8.0 - UNRELEASED HDFS-7863. Missing description of some methods and parameters in javadoc of FSDirDeleteOp. (Brahma Reddy Battula via ozawa) + HDFS-8043. NPE in MiniDFSCluster teardown. (Brahma Reddy Battula via ozawa) + Release 2.7.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java index d92f49e2fd0..d3eaa6ef6c1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java @@ -1744,11 +1744,14 @@ public class MiniDFSCluster { nameNode = null; } } - if (deleteDfsDir) { + if (base_dir != null) { + if (deleteDfsDir) { base_dir.delete(); - } else { + } else { base_dir.deleteOnExit(); + } } + } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientFailover.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientFailover.java index aa149091059..644d66d6ac9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientFailover.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientFailover.java @@ -85,7 +85,9 @@ public class TestDFSClientFailover { @After public void tearDownCluster() throws IOException { - cluster.shutdown(); + if (cluster != null) { + cluster.shutdown(); + } } @After