Skip to content

Commit

Permalink
HADOOP-19290. Operating on / in ChecksumFileSystem throws NPE. (#7074)…
Browse files Browse the repository at this point in the history
…. Contributed by Ayush Saxena.
  • Loading branch information
ayushtkn authored Sep 28, 2024
1 parent 01401d7 commit 3fda243
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 3fda243

Please sign in to comment.