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

This commit is contained in:
Konstantin V Shvachko 2015-01-16 14:31:18 -08:00
parent ec4389cf72
commit 60cbcff2f7
2 changed files with 3 additions and 1 deletions

View File

@ -270,6 +270,8 @@ Trunk (Unreleased)
HDFS-7581. HDFS documentation needs updating post-shell rewrite (aw) HDFS-7581. HDFS documentation needs updating post-shell rewrite (aw)
HDFS-7606. Fix potential NPE in INodeFile.getBlocks(). (Byron Wong via shv)
Release 2.7.0 - UNRELEASED Release 2.7.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -432,7 +432,7 @@ public class INodeFile extends INodeWithAdditionalFields
return snapshotBlocks; return snapshotBlocks;
// Blocks are not in the current snapshot // Blocks are not in the current snapshot
// Find next snapshot with blocks present or return current file blocks // 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; return (snapshotBlocks == null) ? getBlocks() : snapshotBlocks;
} }