[ 
https://issues.apache.org/jira/browse/HADOOP-16138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16797327#comment-16797327
 ] 

Gabor Bota commented on HADOOP-16138:
-------------------------------------

So the issue is that in fs.shell.Command.java:250 we call 
{{PathData.expandAsGlob}} on the path string, which returns null (the 
getFileStatus call will return null) and then there's a call stack:
{noformat}
getFileStatus:434, AzureBlobFileSystem (org.apache.hadoop.fs.azurebfs)
exists:1695, FileSystem (org.apache.hadoop.fs)
processNonexistentPath:76, Mkdir (org.apache.hadoop.fs.shell)
processArgument:288, Command (org.apache.hadoop.fs.shell)
processArguments:270, Command (org.apache.hadoop.fs.shell)
processRawArguments:120, FsCommand (org.apache.hadoop.fs.shell)
run:177, Command (org.apache.hadoop.fs.shell)
run:327, FsShell (org.apache.hadoop.fs)
run:76, ToolRunner (org.apache.hadoop.util)
run:90, ToolRunner (org.apache.hadoop.util)
main:390, FsShell (org.apache.hadoop.fs)
{noformat} 
which will end up calling a 
org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem#makeQualified with null 
parameter which will end up in a stack:
{noformat}
checkPath:712, FileSystem (org.apache.hadoop.fs)
makeQualified:602, FileSystem (org.apache.hadoop.fs)
makeQualified:466, AzureBlobFileSystem (org.apache.hadoop.fs.azurebfs)
getFileStatus:436, AzureBlobFileSystem (org.apache.hadoop.fs.azurebfs)
exists:1695, FileSystem (org.apache.hadoop.fs)
processNonexistentPath:76, Mkdir (org.apache.hadoop.fs.shell)
processArgument:288, Command (org.apache.hadoop.fs.shell)
processArguments:270, Command (org.apache.hadoop.fs.shell)
processRawArguments:120, FsCommand (org.apache.hadoop.fs.shell)
run:177, Command (org.apache.hadoop.fs.shell)
run:327, FsShell (org.apache.hadoop.fs)
run:76, ToolRunner (org.apache.hadoop.util)
run:90, ToolRunner (org.apache.hadoop.util)
main:390, FsShell (org.apache.hadoop.fs)
{noformat}
so it will call {{URI uri = path.toUri();}} inside checkPath, but path will be 
null.

The solution is to check in 
{{org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem#getFileStatus}} if Path f 
is null, instead of directly calling makeQualified.

I'll create a pr soon with this.

> hadoop fs mkdir / of nonexistent abfs container raises NPE
> ----------------------------------------------------------
>
>                 Key: HADOOP-16138
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16138
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.2.0
>            Reporter: Steve Loughran
>            Assignee: Gabor Bota
>            Priority: Minor
>
> If you try to do a mkdir on the root of a nonexistent container, you get an 
> NPE
> {code}
> hadoop fs -mkdir  abfs://[email protected]/  
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to