Browse Source

HDFS-7606. Fix potential NPE in INodeFile.getBlocks(). Contributed by Byron Wong.

Konstantin V Shvachko 10 năm trước cách đây
mục cha
commit
a116e1fe9e

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -487,6 +487,8 @@ Release 2.7.0 - UNRELEASED
 
     HDFS-7644. minor typo in HttpFS doc (Charles Lamb via aw)
 
+    HDFS-7606. Fix potential NPE in INodeFile.getBlocks(). (Byron Wong via shv)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java

@@ -432,7 +432,7 @@ public class INodeFile extends INodeWithAdditionalFields
       return snapshotBlocks;
     // Blocks are not in the current snapshot
     // Find next snapshot with blocks present or return current file blocks
-    snapshotBlocks = getDiffs().findLaterSnapshotBlocks(diff.getSnapshotId());
+    snapshotBlocks = getDiffs().findLaterSnapshotBlocks(snapshot);
     return (snapshotBlocks == null) ? getBlocks() : snapshotBlocks;
   }