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

This commit is contained in:
Konstantin V Shvachko 2015-01-24 16:16:58 -08:00
parent 00a7ebab22
commit a116e1fe9e
2 changed files with 3 additions and 1 deletions

View File

@ -487,6 +487,8 @@ Release 2.7.0 - UNRELEASED
HDFS-7644. minor typo in HttpFS doc (Charles Lamb via aw) 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 Release 2.6.1 - 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;
} }