HADOOP-19290. Operating on / in ChecksumFileSystem throws NPE. (#7074). Contributed by Ayush Saxena.
This commit is contained in:
parent
01401d71ef
commit
3fda243419
@ -770,7 +770,7 @@ public FSDataOutputStream createNonRecursive(final Path f,
|
||||
abstract class FsOperation {
|
||||
boolean run(Path p) throws IOException {
|
||||
boolean status = apply(p);
|
||||
if (status) {
|
||||
if (status && !p.isRoot()) {
|
||||
Path checkFile = getChecksumFile(p);
|
||||
if (fs.exists(checkFile)) {
|
||||
apply(checkFile);
|
||||
|
@ -300,4 +300,11 @@ public void testSetPermissionCrc() throws Exception {
|
||||
assertEquals(perm, rawFs.getFileStatus(crc).getPermission());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationOnRoot() throws Exception {
|
||||
Path p = new Path("/");
|
||||
localFs.mkdirs(p);
|
||||
localFs.setReplication(p, localFs.getFileStatus(p).getPermission().toShort());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user