[
https://issues.apache.org/jira/browse/HDFS-7606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14279526#comment-14279526
]
Chen He commented on HDFS-7606:
-------------------------------
{quote}(i.e. we can only have null blocks when we want to completely destroy
the INodeFile){quote}
INodeFile with empty blocks is created and used for partial functionality
verification in many test cases in TestINodeFile.java.
{quote}The only way to reproduce the NPE is by explicitly creating an INodeFile
with null blocks as you've done in your test. I don't think we need to
reproduce the NPE in a unit test if this is the case.{quote}
There is more than one way to reproduce NPE for this JIRA. Just follow the
condition in my previous comments. To address a possible or potential error, as
an ASF contributor, we need to reproduce it if we can do. Otherwise, how can
you prove it is a bug or error that needs to be fixed?
> 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-1.patch, HDFS-7606.patch, 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)