Author: arp
Date: Tue May 6 00:25:28 2014
New Revision: 1592647
URL: http://svn.apache.org/r1592647
Log:
HADOOP-10562. Namenode exits on exception without printing stack trace in
AbstractDelegationTokenSecretManager. (Contributed by Suresh Srinivas)
Modified:
hadoop/common/branches/branch-1/CHANGES.txt
hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1592647&r1=1592646&r2=1592647&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Tue May 6 00:25:28 2014
@@ -211,6 +211,10 @@ Release 1.3.0 - unreleased
HDFS-6141. WebHdfsFileSystem#toUrl does not perform character escaping.
(cnauroth)
+ HADOOP-10562. Namenode exits on exception without printing stack trace
+ in AbstractDelegationTokenSecretManager. (Suresh Srinivas via
+ Arpit Agarwal)
+
Release 1.2.2 - unreleased
INCOMPATIBLE CHANGES
Modified:
hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java?rev=1592647&r1=1592646&r2=1592647&view=diff
==============================================================================
---
hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
(original)
+++
hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
Tue May 6 00:25:28 2014
@@ -252,22 +252,19 @@ extends AbstractDelegationTokenIdentifie
DataInputStream in = new DataInputStream(buf);
TokenIdent id = createIdentifier();
id.readFields(in);
- LOG.info("Token renewal requested for identifier: "+id);
+ LOG.info("Token renewal for identifier: " + id + "; total currentTokens "
+ + currentTokens.size());
if (id.getMaxDate() < now) {
- throw new InvalidToken("User " + renewer +
- " tried to renew an expired token");
+ throw new InvalidToken(renewer + " tried to renew an expired token");
}
if ((id.getRenewer() == null) || ("".equals(id.getRenewer().toString()))) {
- throw new AccessControlException("User " + renewer +
- " tried to renew a token without " +
- "a renewer");
+ throw new AccessControlException(renewer +
+ " tried to renew a token without a renewer");
}
if (!id.getRenewer().toString().equals(renewer)) {
- throw new AccessControlException("Client " + renewer +
- " tries to renew a token with " +
- "renewer specified as " +
- id.getRenewer());
+ throw new AccessControlException(renewer +
+ " tried to renew a token with renewer " + id.getRenewer());
}
DelegationKey key = allKeys.get(id.getMasterKeyId());
if (key == null) {
@@ -278,8 +275,8 @@ extends AbstractDelegationTokenIdentifie
}
byte[] password = createPassword(token.getIdentifier(), key.getKey());
if (!Arrays.equals(password, token.getPassword())) {
- throw new AccessControlException("Client " + renewer
- + " is trying to renew a token with " + "wrong password");
+ throw new AccessControlException(renewer
+ + " is trying to renew a token with wrong password");
}
long renewTime = Math.min(id.getMaxDate(), now + tokenRenewInterval);
DelegationTokenInformation info = new DelegationTokenInformation(renewTime,
@@ -319,8 +316,7 @@ extends AbstractDelegationTokenIdentifie
throw new AccessControlException(canceller
+ " is not authorized to cancel the token");
}
- DelegationTokenInformation info = null;
- info = currentTokens.remove(id);
+ DelegationTokenInformation info = currentTokens.remove(id);
if (info == null) {
throw new InvalidToken("Token not found");
}
@@ -420,8 +416,7 @@ extends AbstractDelegationTokenIdentifie
}
}
} catch (Throwable t) {
- LOG.error("ExpiredTokenRemover thread received unexpected exception. "
- + t);
+ LOG.error("ExpiredTokenRemover thread received unexpected exception",
t);
Runtime.getRuntime().exit(-1);
}
}