hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r962998 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/security/Credentials.java
Date Sun, 11 Jul 2010 06:43:18 GMT
Author: ddas
Date: Sun Jul 11 06:43:18 2010
New Revision: 962998

URL: http://svn.apache.org/viewvc?rev=962998&view=rev
Log:
HADOOP-6648. Adds a check for null tokens in Credentials.addToken api. Contributed by Owen
O'Malley and Devaraj Das.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/security/Credentials.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=962998&r1=962997&r2=962998&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Sun Jul 11 06:43:18 2010
@@ -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

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/security/Credentials.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/security/Credentials.java?rev=962998&r1=962997&r2=962998&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/security/Credentials.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/security/Credentials.java Sun Jul 11 06:43:18
2010
@@ -36,6 +36,8 @@ import org.apache.hadoop.security.token.
 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 @@ import org.apache.hadoop.classification.
 @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 class Credentials implements Writ
    * @param t the token object
    */
   public void addToken(Text alias, Token<? extends TokenIdentifier> t) {
-    tokenMap.put(alias, t);
+    if (t != null) {
+      tokenMap.put(alias, t);
+    } else {
+      LOG.warn("Null token ignored for " + alias);
+    }
   }
   
   /**



Mime
View raw message