YARN-5048. DelegationTokenRenewer#skipTokenRenewal may throw NPE (Jian He via Yongjun Zhang)

This commit is contained in:
Yongjun Zhang 2016-05-06 21:50:09 -07:00
parent 6957e45699
commit 47c41e7ac7
1 changed files with 7 additions and 2 deletions

View File

@ -539,9 +539,14 @@ public class DelegationTokenRenewer extends AbstractService {
*/
private boolean skipTokenRenewal(Token<?> token)
throws IOException {
@SuppressWarnings("unchecked")
Text renewer = ((Token<AbstractDelegationTokenIdentifier>)token).
decodeIdentifier().getRenewer();
AbstractDelegationTokenIdentifier identifier =
((Token<AbstractDelegationTokenIdentifier>) token).decodeIdentifier();
if (identifier == null) {
return false;
}
Text renewer = identifier.getRenewer();
return (renewer != null && renewer.toString().equals(""));
}