Author: tomwhite
Date: Tue Sep 8 12:18:06 2009
New Revision: 812479
URL: http://svn.apache.org/viewvc?rev=812479&view=rev
Log:
HADOOP-6009. S3N listStatus incorrectly returns null instead of empty array
when called on empty root. Contributed by Ian Nowland.
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java
hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java
Modified: hadoop/common/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=812479&r1=812478&r2=812479&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Tue Sep 8 12:18:06 2009
@@ -987,6 +987,9 @@
HADOOP-6243. Fix a NullPointerException in processing deprecated keys.
(Sreekanth Ramakrishnan via yhemanth)
+ HADOOP-6009. S3N listStatus incorrectly returns null instead of empty
+ array when called on empty root. (Ian Nowland via tomwhite)
+
Release 0.20.1 - Unreleased
INCOMPATIBLE CHANGES
Modified:
hadoop/common/trunk/src/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java?rev=812479&r1=812478&r2=812479&view=diff
==============================================================================
---
hadoop/common/trunk/src/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java
(original)
+++
hadoop/common/trunk/src/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java
Tue Sep 8 12:18:06 2009
@@ -455,6 +455,7 @@
} while (priorLastKey != null);
if (status.isEmpty() &&
+ key.length() > 0 &&
store.retrieveMetadata(key + FOLDER_SUFFIX) == null) {
throw new FileNotFoundException("File " + f + " does not exist.");
}
Modified:
hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java?rev=812479&r1=812478&r2=812479&view=diff
==============================================================================
---
hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java
(original)
+++
hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java
Tue Sep 8 12:18:06 2009
@@ -48,10 +48,13 @@
}
public void testListStatusForRoot() throws Exception {
+ FileStatus[] paths = fs.listStatus(path("/"));
+ assertEquals(0, paths.length);
+
Path testDir = path("/test");
assertTrue(fs.mkdirs(testDir));
- FileStatus[] paths = fs.listStatus(path("/"));
+ paths = fs.listStatus(path("/"));
assertEquals(1, paths.length);
assertEquals(path("/test"), paths[0].getPath());
}