[
https://issues.apache.org/jira/browse/HADOOP-19290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17885271#comment-17885271
]
Ayush Saxena commented on HADOOP-19290:
---------------------------------------
This code part
{noformat}
public Path getChecksumFile(Path file) {
return new Path(file.getParent(), "." + file.getName() + ".crc");
{noformat}
if Path is {{/}} the {{file.getParent()}} would be {{null}} and the {{Path}}
constructor will lead to NPE
I plan add is not root check when we try to fetch the checksum file
{noformat}
boolean status = apply(p);
if (status && !p.isRoot()) {
Path checkFile = getChecksumFile(p);
{noformat}
There won't be no checkFile for root, so we can add {{ !p.isRoot()}} and avoid
this code path, actually I think we can avoid it for all directories, maybe the
reason for not checking whether the path is a directory or not was to avoid an
additional {{getFileStatus}} call to figure out whether the path is directory
or not. but the root check is no cost so should be safe from perf side as well.
> Operating on / in ChecksumFileSystem throws NPE
> -----------------------------------------------
>
> Key: HADOOP-19290
> URL: https://issues.apache.org/jira/browse/HADOOP-19290
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Ayush Saxena
> Assignee: Ayush Saxena
> Priority: Major
>
> Operating on / on ChecksumFileSystem throws NPE
> {noformat}
> java.lang.NullPointerException
> at org.apache.hadoop.fs.Path.<init>(Path.java:151)
> at org.apache.hadoop.fs.Path.<init>(Path.java:130)
> at
> org.apache.hadoop.fs.ChecksumFileSystem.getChecksumFile(ChecksumFileSystem.java:121)
> at
> org.apache.hadoop.fs.ChecksumFileSystem$FsOperation.run(ChecksumFileSystem.java:774)
> at
> org.apache.hadoop.fs.ChecksumFileSystem.setReplication(ChecksumFileSystem.java:884)
> {noformat}
> Internally I observed it for SetPermission but on my Mac LocalFs doesn't let
> me setPermission on "/", so I reproduced it via SetReplication which goes
> through the same code path
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]