Browse Source

HADOOP-1935. Fix a NullPointerException in internalReleaseCreate.
(Dhruba Borthakur)



git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@580871 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 18 years ago
parent
commit
2dc361fa29
2 changed files with 10 additions and 0 deletions
  1. 3 0
      CHANGES.txt
  2. 7 0
      src/java/org/apache/hadoop/dfs/FSNamesystem.java

+ 3 - 0
CHANGES.txt

@@ -94,6 +94,9 @@ Trunk (unreleased changes)
 
 
   BUG FIXES
   BUG FIXES
 
 
+    HADOOP-1935. Fix a NullPointerException in internalReleaseCreate.
+    (Dhruba Borthakur)
+
     HADOOP-1933. The nodes listed in include and exclude files 
     HADOOP-1933. The nodes listed in include and exclude files 
     are always listed in the datanode report.
     are always listed in the datanode report.
     (Raghu Angadi via dhruba)
     (Raghu Angadi via dhruba)

+ 7 - 0
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -1487,6 +1487,13 @@ class FSNamesystem implements FSConstants {
   private void internalReleaseCreate(String src, String holder) throws IOException {
   private void internalReleaseCreate(String src, String holder) throws IOException {
     INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) dir.getFileINode(src);
     INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) dir.getFileINode(src);
 
 
+    if (pendingFile == null) {
+      NameNode.stateChangeLog.warn("DIR* NameSystem.internalReleaseCreate: "
+                                   + "attempt to release a create lock on "
+                                   + src + " file does not exist.");
+      return;
+    }
+
     // The last block that was allocated migth not have been used by the
     // The last block that was allocated migth not have been used by the
     // client. In this case, the size of the last block would be 0. A fsck
     // client. In this case, the size of the last block would be 0. A fsck
     // will report this block as a missing block because no datanodes have it.
     // will report this block as a missing block because no datanodes have it.