HADOOP-6009. S3N listStatus incorrectly returns null instead of empty array when called on empty root. Contributed by Ian Nowland.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@812479 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4a4dd27571
commit
174b3e8a74
|
@ -987,6 +987,9 @@ Trunk (unreleased changes)
|
|||
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
|
||||
|
|
|
@ -455,6 +455,7 @@ public class NativeS3FileSystem extends FileSystem {
|
|||
} while (priorLastKey != null);
|
||||
|
||||
if (status.isEmpty() &&
|
||||
key.length() > 0 &&
|
||||
store.retrieveMetadata(key + FOLDER_SUFFIX) == null) {
|
||||
throw new FileNotFoundException("File " + f + " does not exist.");
|
||||
}
|
||||
|
|
|
@ -48,10 +48,13 @@ public abstract class NativeS3FileSystemContractBaseTest
|
|||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue