diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java index cca14e9472f..fd12f11c789 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java @@ -539,9 +539,14 @@ public class DelegationTokenRenewer extends AbstractService { */ private boolean skipTokenRenewal(Token token) throws IOException { + @SuppressWarnings("unchecked") - Text renewer = ((Token)token). - decodeIdentifier().getRenewer(); + AbstractDelegationTokenIdentifier identifier = + ((Token) token).decodeIdentifier(); + if (identifier == null) { + return false; + } + Text renewer = identifier.getRenewer(); return (renewer != null && renewer.toString().equals("")); }