[
https://issues.apache.org/jira/browse/HADOOP-12056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14571860#comment-14571860
]
zhihai xu commented on HADOOP-12056:
------------------------------------
Hi [~eddyxu], thanks for the review.
It looks like PathUtils is located at HDFS project, which is not accessible by
TestDiskChecker.
So instead of using PathUtils, I use directory "target/TestDiskChecker" {{new
Path("target", TestDiskChecker.class.getSimpleName())}}
bq. Why not pass a file directly?
I tried, but it is failed with "Not a directory" exception at
{{DiskChecker#checkDirAccess}}
{code}
if (!dir.isDirectory()) {
throw new DiskErrorException("Not a directory: "
+ dir.toString());
}
{code}
I uploaded a new patch HADOOP-12056.001.patch which addressed all the other
comments. Please review it.
> DiskChecker#checkDirs should check null pointer for the return value from
> File#listFiles to avoid NPE.
> ------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-12056
> URL: https://issues.apache.org/jira/browse/HADOOP-12056
> Project: Hadoop Common
> Issue Type: Bug
> Components: util
> Affects Versions: 2.7.0
> Reporter: zhihai xu
> Assignee: zhihai xu
> Attachments: HADOOP-12056.000.patch, HADOOP-12056.001.patch
>
>
> DiskChecker#checkDirs should check null pointer for the return value from
> File#listFiles. Based on the document for File#listFiles at
> https://docs.oracle.com/javase/7/docs/api/java/io/File.html#listFiles() :
> {code}
> Returns null if an I/O error occurs.
> {code}
> So it will be good to check null pointer and throw DiskErrorException if it
> is null.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)