浏览代码

HADOOP-1156. Fix a NullPointerException in MiniDFSCluster. Contributed by Hairong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@525268 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 年之前
父节点
当前提交
9c24b1a9e3
共有 2 个文件被更改,包括 7 次插入3 次删除
  1. 3 0
      CHANGES.txt
  2. 4 3
      src/test/org/apache/hadoop/dfs/MiniDFSCluster.java

+ 3 - 0
CHANGES.txt

@@ -91,6 +91,9 @@ Trunk (unreleased changes)
 28. HADOOP-1045.  Add contrib/hbase, a BigTable-like online database.
     (Jim Kellerman via cutting)
 
+29. HADOOP-1156.  Fix a NullPointerException in MiniDFSCluster.
+    (Hairong Kuang via cutting)
+
 
 Release 0.12.3 (not yet released)
 

+ 4 - 3
src/test/org/apache/hadoop/dfs/MiniDFSCluster.java

@@ -90,7 +90,7 @@ public class MiniDFSCluster {
           isInitialized = true;
         }
       } catch (Throwable e) {
-        node = null;
+        shutdown();
         System.err.println("Name node crashed:");
         e.printStackTrace();
         synchronized (this) {
@@ -107,6 +107,7 @@ public class MiniDFSCluster {
       if (node != null) {
         node.stop();
         node.join();
+        node = null;
       }
     }
   }
@@ -157,8 +158,7 @@ public class MiniDFSCluster {
         }
         node.run();
       } catch (Throwable e) {
-        node.shutdown();
-        node = null;
+        shutdown();
         System.err.println("Data node crashed:");
         e.printStackTrace();
       }
@@ -171,6 +171,7 @@ public class MiniDFSCluster {
       isRunning = false;
       if (node != null) {
         node.shutdown();
+        node = null;
       }
     }
   }