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

Vinayakumar B commented on HDFS-8627:
-------------------------------------

Patch looks almost okay.

Small Nit in test.
Instead of trying to read and expecting IOException as below, can directly 
check for the existence of the token file. Token file should not get created in 
case of null token.
{code}+    Credentials.readTokenStorageFile(p, conf);{code}

> NPE thrown if unable to fetch token from Namenode
> -------------------------------------------------
>
>                 Key: HDFS-8627
>                 URL: https://issues.apache.org/jira/browse/HDFS-8627
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: J.Andreina
>            Assignee: J.Andreina
>         Attachments: HDFS-8627.1.patch
>
>
> DelegationTokenFetcher#saveDelegationToken
> Missed to check if token is null.
> {code}
>     Token<?> token = fs.getDelegationToken(renewer);
>     Credentials cred = new Credentials();
>     cred.addToken(token.getKind(), token);
> {code}
> {noformat}
> XXXXXXXXXXXXXXXXXX:~/hadoop/namenode/bin> ./hdfs fetchdt --renewer Rex 
> /home/REX/file1
> Exception in thread "main" java.lang.NullPointerException
>         at 
> org.apache.hadoop.hdfs.tools.DelegationTokenFetcher.saveDelegationToken(DelegationTokenFetcher.java:181)
>         at 
> org.apache.hadoop.hdfs.tools.DelegationTokenFetcher$1.run(DelegationTokenFetcher.java:126)
>         at 
> java.security.AccessController.doPrivileged(AccessController.java:314)
>         at javax.security.auth.Subject.doAs(Subject.java:572)
>         at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1666)
>         at 
> org.apache.hadoop.hdfs.tools.DelegationTokenFetcher.main(DelegationTokenFetcher.java:114)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to