Browse Source

HADOOP-6905. Better logging messages when a delegation token is invalid. Contributed by Kan Zhang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@986172 13f79535-47bb-0310-9956-ffa450edef68
Jakob Homan 15 years ago
parent
commit
9950db1817

+ 3 - 0
CHANGES.txt

@@ -117,6 +117,9 @@ Trunk (unreleased changes)
     throw IOException rather than RuntimeException when there is an IO error
     throw IOException rather than RuntimeException when there is an IO error
     fetching the next file. (hairong)
     fetching the next file. (hairong)
 
 
+    HADOOP-6905. Better logging messages when a delegation token is invalid.
+    (Kan Zhang via jghoman)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
   BUG FIXES
   BUG FIXES

+ 3 - 2
src/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java

@@ -198,11 +198,12 @@ extends AbstractDelegationTokenIdentifier>
       throws InvalidToken {
       throws InvalidToken {
     DelegationTokenInformation info = currentTokens.get(identifier);
     DelegationTokenInformation info = currentTokens.get(identifier);
     if (info == null) {
     if (info == null) {
-      throw new InvalidToken("token is expired or doesn't exist");
+      throw new InvalidToken("token (" + identifier.toString()
+          + ") can't be found in cache");
     }
     }
     long now = System.currentTimeMillis();
     long now = System.currentTimeMillis();
     if (info.getRenewDate() < now) {
     if (info.getRenewDate() < now) {
-      throw new InvalidToken("token is expired");
+      throw new InvalidToken("token (" + identifier.toString() + ") is expired");
     }
     }
     return info.getPassword();
     return info.getPassword();
   }
   }