[
https://issues.apache.org/jira/browse/HDFS-7567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14257723#comment-14257723
]
Ted Yu commented on HDFS-7567:
------------------------------
Let's look at first branch where oldFile is null, we have the following
assignment:
{code}
newFile = fsDir.addFileForEditLog(inodeId, iip.getExistingINodes(),
{code}
However, addFileForEditLog() would return null if IOException is encountered:
{code}
} catch (IOException e) {
if(NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug(
"DIR* FSDirectory.unprotectedAddFile: exception when add "
+ existing.getPath() + " to the file system", e);
}
}
return null;
{code}
I think the potential of NPE still exists.
> Potential null dereference in FSEditLogLoader#applyEditLogOp()
> --------------------------------------------------------------
>
> Key: HDFS-7567
> URL: https://issues.apache.org/jira/browse/HDFS-7567
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Ted Yu
> Priority: Minor
>
> {code}
> INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path, true);
> if (oldFile != null && addCloseOp.overwrite) {
> ...
> INodeFile newFile = oldFile;
> ...
> // Update the salient file attributes.
> newFile.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
> newFile.setModificationTime(addCloseOp.mtime,
> Snapshot.CURRENT_STATE_ID);
> {code}
> The last two lines are not protected by null check.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)