[
https://issues.apache.org/jira/browse/HADOOP-7352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042884#comment-13042884
]
Matt Foley commented on HADOOP-7352:
------------------------------------
In a comment in another bug (<a
href="https://issues.apache.org/jira/browse/HADOOP-7327?focusedCommentId=13042494&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13042494">here</a>),
Daryn points out that if the exceptions are thrown from a lower level with
knowledge of the cause of the problem, it would be good to throw something
informative such as AccessControlException, rather than just a generic
IOException.
I agree in principle, but AccessControlException is a subclass of
SecurityException, which is a RuntimeException and therefore no better than
NPE. All of the callers of listStatus() are prepared to get an IOException,
but none of the standard sub-classes of IOException include access failures.
Is there a Hadoop or Apache defined sub-class of IOException that would be
appropriate?
> Contracts of LocalFileSystem and DistributedFileSystem should require
> FileSystem::listStatus throw IOException not return null upon access error
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-7352
> URL: https://issues.apache.org/jira/browse/HADOOP-7352
> Project: Hadoop Common
> Issue Type: Improvement
> Components: fs, fs/s3
> Reporter: Matt Foley
> Assignee: Matt Foley
>
> In HADOOP-6201 and HDFS-538 it was agreed that FileSystem::listStatus should
> throw FileNotFoundException instead of returning null, when the target
> directory did not exist.
> However, in LocalFileSystem implementation today, FileSystem::listStatus
> still may return null, when the target directory exists but does not grant
> read permission. This causes NPE in many callers, for all the reasons cited
> in HADOOP-6201 and HDFS-538. See HADOOP-7327 and its linked issues for
> examples.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira