[ 
https://issues.apache.org/jira/browse/HADOOP-9415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Wang updated HADOOP-9415:
--------------------------------

    Attachment: hadoop-9415-2.patch

Hi Konstantin,

Sure, let's just get this one fixed. Probably shouldn't have lumped it in as a 
subtask, sorry. Feel free to move it out to HDFS if you like.

As a bit of background, {{ClientProtocol#getLinkTarget}} is only called during 
symlink resolution. It's unfortunate that there's a method with the same name 
in {{FileContext}}. I also agree this isn't the right fix, I saw the {{return 
null}} at the end of the method and assumed it was handled, but in fact it 
should never hit that.

I think {{NameNodeRpcServer#getLinkTarget}} confused {{HdfsFileStatus}} with 
{{FileStatus}}, which has a {{#getSymlink}} method which does actually throw an 
IOException. I think the right fix here though is having 
{{NameNodeRpcServer#getLinkTarget}} do the {{isSymlink()}} check then throw an 
{{IOException}} itself. This is essentially what other usages of this method do.

Patch attached that tries to clean this up.
                
> Fix NullPointerException in getLinkTarget
> -----------------------------------------
>
>                 Key: HADOOP-9415
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9415
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs
>    Affects Versions: 3.0.0
>            Reporter: Andrew Wang
>            Assignee: Andrew Wang
>            Priority: Minor
>         Attachments: hadoop-9415-1.patch, hadoop-9415-2.patch
>
>
> {{HdfsFileStatus#getLinkTarget}} can throw a NPE in {{DFSUtil#bytes2String}} 
> if {{symlink}} is null. Better to instead return null and propagate this to 
> the client.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to