HADOOP-6648. Adds a check for null tokens in Credentials.addToken api. Contributed by Owen O'Malley and Devaraj Das.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@962998 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Devaraj Das 2010-07-11 06:43:18 +00:00
parent 0ae9cbb3a4
commit 4ff2991849
2 changed files with 11 additions and 1 deletions

View File

@ -115,6 +115,9 @@ Trunk (unreleased changes)
HADOOP-6815. refreshSuperUserGroupsConfiguration should use server side
configuration for the refresh (boryas)
HADOOP-6648. Adds a check for null tokens in Credentials.addToken api.
(ddas)
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES

View File

@ -36,6 +36,8 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A class that provides the facilities of reading and writing
@ -44,6 +46,7 @@
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public class Credentials implements Writable {
private static final Log LOG = LogFactory.getLog(Credentials.class);
private Map<Text, byte[]> secretKeysMap = new HashMap<Text, byte[]>();
private Map<Text, Token<? extends TokenIdentifier>> tokenMap =
@ -73,7 +76,11 @@ public Token<? extends TokenIdentifier> getToken(Text alias) {
* @param t the token object
*/
public void addToken(Text alias, Token<? extends TokenIdentifier> t) {
if (t != null) {
tokenMap.put(alias, t);
} else {
LOG.warn("Null token ignored for " + alias);
}
}
/**