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 ji...@apache.org on 2011/09/21 22:59:12 UTC

svn commit: r1173854 - in /hadoop/common/branches/branch-0.20-security-205: ./ src/core/org/apache/hadoop/fs/ src/hdfs/org/apache/hadoop/hdfs/ src/test/org/apache/hadoop/fs/

Author: jitendra
Date: Wed Sep 21 20:59:11 2011
New Revision: 1173854

URL: http://svn.apache.org/viewvc?rev=1173854&view=rev
Log:
Merged r1173843 from branch-0.20-security for HADOOP-7661.

Modified:
    hadoop/common/branches/branch-0.20-security-205/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FileSystem.java
    hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FilterFileSystem.java
    hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
    hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java

Modified: hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/CHANGES.txt?rev=1173854&r1=1173853&r2=1173854&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security-205/CHANGES.txt Wed Sep 21 20:59:11 2011
@@ -166,6 +166,9 @@ Release 0.20.205.0 - 2011.09.12
     HADOOP-7615. Fixes to have contrib jars in the HADOOP_CLASSPATH
     for the binary layout case. (Eric Yang via ddas) 
 
+    HADOOP-7661. FileSystem.getCanonicalServiceName throws NPE for any 
+    file system uri that doesn't have an authority. (jitendra)
+
   IMPROVEMENTS
 
     MAPREDUCE-2187. Reporter sends progress during sort/merge. (Anupam Seth via

Propchange: hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 21 20:59:11 2011
@@ -1,6 +1,6 @@
 /hadoop/common/branches/branch-0.20/CHANGES.txt:826138,826568,829987,831184,833001,880632,898713,909245,909723,960946,990003,1044225
 /hadoop/common/branches/branch-0.20-append/CHANGES.txt:955380,955398,955448,956329
-/hadoop/common/branches/branch-0.20-security/CHANGES.txt:1170042,1171181,1171891,1171905,1172184,1172188,1172190,1172192
+/hadoop/common/branches/branch-0.20-security/CHANGES.txt:1170042,1171181,1171891,1171905,1172184,1172188,1172190,1172192,1173843
 /hadoop/common/branches/branch-0.20-security-203/CHANGES.txt:1096071,1097011,1097249,1097269,1097281,1097966,1098816,1098819,1098823,1098827,1098832,1098839,1098854,1098863,1099088,1099191,1099324,1099330,1099333,1102071,1128115
 /hadoop/common/branches/branch-0.20-security-204/CHANGES.txt:1128390,1147228,1148069,1149316,1154413,1159730,1161741
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226

Modified: hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FileSystem.java?rev=1173854&r1=1173853&r2=1173854&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FileSystem.java Wed Sep 21 20:59:11 2011
@@ -167,11 +167,14 @@ public abstract class FileSystem extends
   }
 
   /**
-   * Get a canonical name for this file system.
-   * @return a URI string that uniquely identifies this file system
+   * Get a canonical name for this file system. It returns the uri of the file
+   * system unless overridden by a FileSystem implementation. File Systems with
+   * a valid authority can choose to return host:port or ip:port.
+   * 
+   * @return A string that uniquely identifies this file system
    */
   public String getCanonicalServiceName() {
-    return SecurityUtil.buildDTServiceName(getUri(), getDefaultPort());
+    return getUri().toString();
   }
   
   /** @deprecated call #getUri() instead.*/

Modified: hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FilterFileSystem.java?rev=1173854&r1=1173853&r2=1173854&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FilterFileSystem.java (original)
+++ hadoop/common/branches/branch-0.20-security-205/src/core/org/apache/hadoop/fs/FilterFileSystem.java Wed Sep 21 20:59:11 2011
@@ -23,6 +23,7 @@ import java.net.URI;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.util.Progressable;
 
 /****************************************************************
@@ -68,6 +69,11 @@ public class FilterFileSystem extends Fi
   public URI getUri() {
     return fs.getUri();
   }
+  
+  @Override
+  public String getCanonicalServiceName() {
+    return fs.getCanonicalServiceName();
+  }
 
   /** @deprecated call #getUri() instead.*/
   public String getName() {

Modified: hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1173854&r1=1173853&r2=1173854&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java (original)
+++ hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java Wed Sep 21 20:59:11 2011
@@ -39,6 +39,7 @@ import org.apache.hadoop.hdfs.server.nam
 import org.apache.hadoop.hdfs.DFSClient.DFSOutputStream;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.SecretManager.InvalidToken;
 import org.apache.hadoop.util.Progressable;
@@ -65,6 +66,11 @@ public class DistributedFileSystem exten
   public DistributedFileSystem() {
   }
 
+  @Override
+  public String getCanonicalServiceName() {
+    return SecurityUtil.buildDTServiceName(getUri(), getDefaultPort());
+  }
+  
   /** @deprecated */
   public DistributedFileSystem(InetSocketAddress namenode,
     Configuration conf) throws IOException {

Modified: hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java?rev=1173854&r1=1173853&r2=1173854&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java Wed Sep 21 20:59:11 2011
@@ -19,6 +19,7 @@ package org.apache.hadoop.fs;
 
 import org.apache.hadoop.conf.Configuration;
 import java.io.*;
+
 import junit.framework.*;
 
 /**
@@ -153,4 +154,10 @@ public class TestLocalFileSystem extends
     assertEquals(path.makeQualified(fs), status.getPath());
     cleanupFile(fs, path);
   }
+  
+  public void testGetCanonicalServiceName() throws IOException {
+    Configuration conf = new Configuration();
+    FileSystem fs = FileSystem.getLocal(conf);
+    assertEquals(fs.getUri().toString(), fs.getCanonicalServiceName());
+  }
 }