HADOOP-13830. Intermittent failure of ITestS3NContractRootDir#testRecursiveRootListing: "Can not create a Path from an empty string". Contributed by Steve Loughran
(cherry picked from commit 3fd844b99f
)
This commit is contained in:
parent
7f4bd1af52
commit
afad13f8d9
|
@ -574,8 +574,13 @@ public class NativeS3FileSystem extends FileSystem {
|
||||||
for (String commonPrefix : listing.getCommonPrefixes()) {
|
for (String commonPrefix : listing.getCommonPrefixes()) {
|
||||||
Path subpath = keyToPath(commonPrefix);
|
Path subpath = keyToPath(commonPrefix);
|
||||||
String relativePath = pathUri.relativize(subpath.toUri()).getPath();
|
String relativePath = pathUri.relativize(subpath.toUri()).getPath();
|
||||||
|
// sometimes the common prefix includes the base dir (HADOOP-13830).
|
||||||
|
// avoid that problem by detecting it and keeping it out
|
||||||
|
// of the list
|
||||||
|
if (!relativePath.isEmpty()) {
|
||||||
status.add(newDirectory(new Path(absolutePath, relativePath)));
|
status.add(newDirectory(new Path(absolutePath, relativePath)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
priorLastKey = listing.getPriorLastKey();
|
priorLastKey = listing.getPriorLastKey();
|
||||||
} while (priorLastKey != null);
|
} while (priorLastKey != null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue