[
https://issues.apache.org/jira/browse/HDFS-7606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14278325#comment-14278325
]
Konstantin Shvachko commented on HDFS-7606:
-------------------------------------------
Hey Chen, if I am not mistaken the NPE in getBlocks() is hypothetcial. I don't
think Ted actually reproduced it or if it is reproducible with current code.
Byron,
# should we just use {{snapshot}} instead of {{diff.getSnapshotId()}}? I think
it is the same id.
# For {{computeContentSummary()}} the null check seems to be redundant, as {{n
> 0}} is guaranteed by the {{if}} statement.
> Missing null check in INodeFile#getBlocks()
> -------------------------------------------
>
> Key: HDFS-7606
> URL: https://issues.apache.org/jira/browse/HDFS-7606
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 3.0.0
> Reporter: Ted Yu
> Assignee: Byron Wong
> Priority: Minor
> Attachments: HDFS-7606.patch
>
>
> {code}
> BlockInfo[] snapshotBlocks = diff == null ? getBlocks() :
> diff.getBlocks();
> if(snapshotBlocks != null)
> 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());
> {code}
> If diff is null and snapshotBlocks is null, NullPointerException would result
> from the call to diff.getSnapshotId().
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)