[ 
https://issues.apache.org/jira/browse/HDFS-2065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13139159#comment-13139159
 ] 

Uma Maheswara Rao G commented on HDFS-2065:
-------------------------------------------

Bharath,

There are some more scenarios for getBlockLocations returning null values. i.e, 
when we call getFileCheckSum on non existing files or directories, it will 
throw NullPointerException. These two conditions handled in HDFS-2509

 I think we need to clean some places, where it is checking for null values 
from getBlockLocations.
See the code below from NameNodeFsck

{code}
LocatedBlocks blocks = namenode.getNamesystem().getBlockLocations(path, 0,
        fileLen, false, false);
    if (blocks == null) { // the file is deleted
      return;
    }
{code}

Also can you please provide one Unit test for this scenario, which should 
illustrate that, when inode.getBlocks() will return null?

Thanks
Uma
                
> Fix NPE in DFSClient.getFileChecksum
> ------------------------------------
>
>                 Key: HDFS-2065
>                 URL: https://issues.apache.org/jira/browse/HDFS-2065
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 0.23.0
>            Reporter: Bharath Mundlapudi
>            Assignee: Bharath Mundlapudi
>             Fix For: 0.23.0
>
>         Attachments: HDFS-2065-1.patch
>
>
> The following code can throw NPE if callGetBlockLocations returns null.
> If server returns null 
> {code}
>     List<LocatedBlock> locatedblocks
>         = callGetBlockLocations(namenode, src, 0, 
> Long.MAX_VALUE).getLocatedBlocks();
> {code}
> The right fix for this is server should throw right exception.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to