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
This commit is contained in:
Jakob Homan 2010-08-17 02:37:26 +00:00
parent 4c940af714
commit 9950db1817
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -198,11 +198,12 @@ public synchronized byte[] retrievePassword(TokenIdent identifier)
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();
} }