[
https://issues.apache.org/jira/browse/HADOOP-15536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512857#comment-16512857
]
Steve Loughran commented on HADOOP-15536:
-----------------------------------------
There's a recurrent problem we have with mkdirs is that returning false can
mean both "there's a dir there, so it's good" and "there's a file there, but
you aren't going to check the return value are you? So your code will fail
later with no obvious reason". This patch seems to replicate the same design
flaw in that return code.
# Where's this method going to be used ?
# And why return 0/1 over true/false?
# What if we had a variant which did throw a FileExistsException if mkdir
failed and the dest was a file?
h3. FileUtil
* Is it an error if, after mkDirs() returns, the destination exists *but is not
a directory*. If so, the check on L1664 needs to look for.
* logging should move to slf4j
{code}
LOG.warn("Unable to create the directory {}", dst);
{code}
+maybe also log that full stack trace @ debug
h3. TestFileUtilsMkDir
* Can you factor out all the {{Assert.assertTrue(directory.exists());}} calls
into two methods, {{assertExists(File)}} and {{assertDoesNotExist(
{{assertDirExists(File)}}, and have them include the relevant filename when the
assert fails? That way, we can debug things from test reports.
* Test that the path really is a directory, and not just exists.
* cleanupImpl must not raise an exception on failure, as that could hide the
initial failure. Better to log
* Add tests to check that you can't mkdir over and underneath files
> Adding support in FileUtil for the creation of directories
> ----------------------------------------------------------
>
> Key: HADOOP-15536
> URL: https://issues.apache.org/jira/browse/HADOOP-15536
> Project: Hadoop Common
> Issue Type: Sub-task
> Reporter: Giovanni Matteo Fumarola
> Assignee: Giovanni Matteo Fumarola
> Priority: Major
> Attachments: HADOOP-15536-HADOOP-15461.v1.patch,
> HADOOP-15536-HADOOP-15461.v2.patch, HADOOP-15536.v1.patch
>
>
> Adding support in FileUtil for the creation of directories.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]