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 bo...@apache.org on 2012/10/23 17:52:42 UTC
svn commit: r1401328 - in
/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common:
CHANGES.txt src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java
Author: bobby
Date: Tue Oct 23 15:52:41 2012
New Revision: 1401328
URL: http://svn.apache.org/viewvc?rev=1401328&view=rev
Log:
svn merge -c 1401325 FIXES: HADOOP-8962. RawLocalFileSystem.listStatus fails when a child filename contains a colon (jlowe via bobby)
Modified:
hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt
hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java
Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1401328&r1=1401327&r2=1401328&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt Tue Oct 23 15:52:41 2012
@@ -47,6 +47,9 @@ Release 0.23.5 - UNRELEASED
HADOOP-8906. paths with multiple globs are unreliable. (Daryn Sharp via
jlowe)
+ HADOOP-8962. RawLocalFileSystem.listStatus fails when a child filename
+ contains a colon (jlowe via bobby)
+
Release 0.23.4 - UNRELEASED
INCOMPATIBLE CHANGES
Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=1401328&r1=1401327&r2=1401328&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java Tue Oct 23 15:52:41 2012
@@ -319,7 +319,7 @@ public class RawLocalFileSystem extends
new RawLocalFileStatus(localf, getDefaultBlockSize(), this) };
}
- String[] names = localf.list();
+ File[] names = localf.listFiles();
if (names == null) {
return null;
}
@@ -327,7 +327,7 @@ public class RawLocalFileSystem extends
int j = 0;
for (int i = 0; i < names.length; i++) {
try {
- results[j] = getFileStatus(new Path(f, names[i]));
+ results[j] = getFileStatus(new Path(names[i].getAbsolutePath()));
j++;
} catch (FileNotFoundException e) {
// ignore the files not found since the dir list may have have changed
Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java?rev=1401328&r1=1401327&r2=1401328&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java Tue Oct 23 15:52:41 2012
@@ -248,4 +248,17 @@ public class TestLocalFileSystem {
}
assertEquals(1, fileSchemeCount);
}
+
+ @Test
+ public void testListStatusWithColons() throws IOException {
+ Configuration conf = new Configuration();
+ LocalFileSystem fs = FileSystem.getLocal(conf);
+ File colonFile = new File(TEST_ROOT_DIR, "foo:bar");
+ colonFile.mkdirs();
+ colonFile.createNewFile();
+ FileStatus[] stats = fs.listStatus(new Path(TEST_ROOT_DIR));
+ assertEquals("Unexpected number of stats", 1, stats.length);
+ assertEquals("Bad path from stat", colonFile.getAbsolutePath(),
+ stats[0].getPath().toUri().getPath());
+ }
}