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

Jason Lowe commented on HADOOP-8709:
------------------------------------

OK, I think I can see the reasoning behind throwing FNFE from globStatus.  
Basically it boils down to breaking the path into directory-level components 
and for each component:

* if the component doesn't contain patterns, treat it like listStatus and throw 
FNFE if it doesn't exist
* if the component contains patterns, treat it like a pattern match and return 
an empty array if it doesn't exist

So for example, if the pattern is /a/b/* but /a/b/ doesn't exist, then it will 
throw FNFE.  However if the pattern is /a/b*/* for the same situation, then it 
will return an empty array even though /a/b* doesn't exist.  It does match my 
expectation that matching shouldn't throw but at a directory component level 
rather than the top-level.

The new behavior seems a bit cumbersome, since callers now have to check for 
both an empty array *and* catch FNFE to handle the case of nothing found.  
However it does provide the ability to distinguish between a non-existent 
expected directory level vs. a pattern matching nothing for some cases.  I can 
see some merit there.

That still leaves the issue of returning null for a non-globbed pattern, which 
I still assume is just broken if we're going to throw FNFE for some globbed 
paths.
                
> globStatus changed behavior from 0.20/1.x
> -----------------------------------------
>
>                 Key: HADOOP-8709
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8709
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 0.23.0, 2.0.0-alpha
>            Reporter: Jason Lowe
>            Assignee: Jason Lowe
>            Priority: Critical
>         Attachments: HADOOP-8709.patch
>
>
> In 0.20 or 1.x, globStatus will return an empty array if the glob pattern 
> does not match any files.  After HADOOP-6201 it throws FileNotFoundException. 
>  The javadoc states it will return an empty array.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to