hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r647003 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FileSystem.java src/test/org/apache/hadoop/fs/TestFileSystem.java
Date Thu, 10 Apr 2008 23:14:19 GMT
Author: rangadi
Date: Thu Apr 10 16:14:10 2008
New Revision: 647003

URL: http://svn.apache.org/viewvc?rev=647003&view=rev
Log:
HADOOP-1373. checkPath() should ignore case when it compares authoriy. (Edward J. Yoon via
rangadi)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=647003&r1=647002&r2=647003&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Apr 10 16:14:10 2008
@@ -562,6 +562,9 @@
 
    HADOOP-3223. Fix typo in help message for -chmod. (rangadi)
 
+   HADOOP-1373. checkPath() should ignore case when it compares authoriy.
+   (Edward J. Yoon via rangadi)
+
 Release 0.16.3 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=647003&r1=647002&r2=647003&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Thu Apr 10 16:14:10 2008
@@ -292,16 +292,18 @@
     String thatScheme = uri.getScheme();
     String thisAuthority = this.getUri().getAuthority();
     String thatAuthority = uri.getAuthority();
-    if (thisScheme.equals(thatScheme)) {          // schemes match
+    //authority and scheme are not case sensitive
+    if (thisScheme.equalsIgnoreCase(thatScheme)) {// schemes match
       if (thisAuthority == thatAuthority ||       // & authorities match
-          (thisAuthority != null && thisAuthority.equals(thatAuthority)))
+          (thisAuthority != null && 
+           thisAuthority.equalsIgnoreCase(thatAuthority)))
         return;
 
       if (thatAuthority == null &&                // path's authority is null
           thisAuthority != null) {                // fs has an authority
         URI defaultUri = getDefaultUri(getConf()); // & is the default fs
-        if (thisScheme.equals(defaultUri.getScheme()) &&
-            thisAuthority.equals(defaultUri.getAuthority()))
+        if (thisScheme.equalsIgnoreCase(defaultUri.getScheme()) &&
+            thisAuthority.equalsIgnoreCase(defaultUri.getAuthority()))
           return;
       }
       throw new IllegalArgumentException("Wrong FS: "+path+

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java?rev=647003&r1=647002&r2=647003&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java Thu Apr 10 16:14:10
2008
@@ -23,6 +23,7 @@
 import java.io.OutputStream;
 import java.util.Arrays;
 import java.util.Random;
+import java.net.InetSocketAddress;
 import java.net.URI;
 
 import junit.framework.TestCase;
@@ -509,6 +510,7 @@
         cluster = new MiniDFSCluster(new Configuration(), 2, true, null);
         URI uri = cluster.getFileSystem().getUri();
         FileSystem fs = FileSystem.get(uri, new Configuration());
+        checkPath(cluster, fs);
         for(int i = 0; i < 100; i++) {
           assertTrue(fs == FileSystem.get(uri, new Configuration()));
         }
@@ -517,7 +519,13 @@
       }
     }
   }
-    
+  
+  private void checkPath(MiniDFSCluster cluster, FileSystem fileSys) throws IOException {
+    InetSocketAddress add = cluster.getNameNode().getNameNodeAddress();
+    // Test upper/lower case
+    fileSys.checkPath(new Path("hdfs://" + add.getHostName().toUpperCase() + ":" + add.getPort()));
+  }
+
   public void testFsClose() throws Exception {
     {
       Configuration conf = new Configuration();



Mime
View raw message