You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:14:28 UTC

svn commit: r1077434 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java

Author: omalley
Date: Fri Mar  4 04:14:28 2011
New Revision: 1077434

URL: http://svn.apache.org/viewvc?rev=1077434&view=rev
Log:
commit 4d5dd9cfd79c4730c9366df6136a3a7c9b26151d
Author: Devaraj Das <dd...@yahoo-inc.com>
Date:   Thu Apr 29 12:51:22 2010 -0700

    HDFS:1007 from https://issues.apache.org/jira/secure/attachment/12443223/1007-bugfix.patch
    
    +++ b/YAHOO-CHANGES.txt
    +Release 0.20.101.1 - unreleased
    +
    +    . Fixes NPE in the distcp to do with handling of null Tokens
    +    (ddas)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java?rev=1077434&r1=1077433&r2=1077434&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java Fri Mar  4 04:14:28 2011
@@ -141,18 +141,20 @@ public class TokenCache {
         //the initialize method of hftp, called via FileSystem.get() done
         //earlier gets a delegation token
         Token<? extends TokenIdentifier> t = ((HftpFileSystem) fs).getDelegationToken(); 
-        credentials.addToken(new Text(fs_addr), t);
+        if (t != null) {
+          credentials.addToken(new Text(fs_addr), t);
         
-        // in this case port in fs_addr is port for hftp request, but
-        // token's port is for RPC
-        // to find the correct DT we need to know the mapping between Hftp port 
-        // and RPC one. hence this new setting in the conf.
-        URI uri = ((HftpFileSystem) fs).getUri();
-        String key = HftpFileSystem.HFTP_SERVICE_NAME_KEY+
-           SecurityUtil.buildDTServiceName(uri, NameNode.DEFAULT_PORT);
-        conf.set(key, t.getService().toString());
-        LOG.info("GOT dt for " + p + " and stored in conf as " + key + "=" 
-            + t.getService());
+          // in this case port in fs_addr is port for hftp request, but
+          // token's port is for RPC
+          // to find the correct DT we need to know the mapping between Hftp port 
+          // and RPC one. hence this new setting in the conf.
+          URI uri = ((HftpFileSystem) fs).getUri();
+          String key = HftpFileSystem.HFTP_SERVICE_NAME_KEY+
+             SecurityUtil.buildDTServiceName(uri, NameNode.DEFAULT_PORT);
+          conf.set(key, t.getService().toString());
+          LOG.info("GOT dt for " + p + " and stored in conf as " + key + "=" 
+              + t.getService());
+        }
       }
     }
   }