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

Yongjun Zhang commented on HDFS-10211:
--------------------------------------

HI [~cnauroth], 

Thanks for bringing HDFS-9732 to my attention. Indeed it's for the same issue. 
I hoped that no code counts on the output of this method, but reading the 
comment in HDFS-9732 indicates there is indeed code depending on it. which is 
really bad. We should really avoid this kind of dependency. I will follow up in 
that jira.




> Add more info to DelegationTokenIdentifier#toString for better supportability
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-10211
>                 URL: https://issues.apache.org/jira/browse/HDFS-10211
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Yongjun Zhang
>            Assignee: Yongjun Zhang
>
> Base class {{AbstractDelegationTokenIdentifier}} has the following 
> implementation of {{toString()}} method
> {code}
> @Override
>   public String toString() {
>     StringBuilder buffer = new StringBuilder();
>     buffer
>         .append("owner=" + owner + ", renewer=" + renewer + ", realUser="
>             + realUser + ", issueDate=" + issueDate + ", maxDate=" + maxDate
>             + ", sequenceNumber=" + sequenceNumber + ", masterKeyId="
>             + masterKeyId);
>     return buffer.toString();
>   }
> {code}
> However, derived class 
> {{org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier}}
> has the following implementation that overrides the base class above:
> {code}
>   @Override
>   public String toString() {
>     return getKind() + " token " + getSequenceNumber()
>         + " for " + getUser().getShortUserName();
>   }
> {code}
> And when exception is thrown because of token expiration or other reason:
> {code}
>     if (info.getRenewDate() < Time.now()) {
>       throw new InvalidToken("token (" + identifier.toString() + ") is 
> expired");
>     }
> {code}
> The exception doesn't show the detailed information about the token, like the 
> base class' toString() method returns.
> Creating this jira to change the 
> {{org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier}}
>  implementation to include all the info about the token, as included by the 
> base class.
> This change would help supportability, at the expense of printing a little 
> more information to the log. I hope no code really depends on the output 
> string. 



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

Reply via email to