[
https://issues.apache.org/jira/browse/IO-205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709664#action_12709664
]
Sebb edited comment on IO-205 at 3/5/10 1:46 AM:
-------------------------------------------------
Surely it's also possible for a directory entry to be neither a file nor a
directory, so maybe the check should be:
{code}
File.isFile() && !File.isDirectory()
{code}
[Later] A File may perhaps be neither but that's not relevant as we are only
interested in whether an existing File is a directory or not.
was (Author: [email protected]):
Surely it's also possible for a directory entry to be neither a file nor a
directory, so maybe the check should be:
{code}
File.isFile() && !File.isDirectory()
{code}
> FileUtils.forceMkdir Javadoc is unclear
> ---------------------------------------
>
> Key: IO-205
> URL: https://issues.apache.org/jira/browse/IO-205
> Project: Commons IO
> Issue Type: Bug
> Reporter: Trejkaz
>
> The Javadoc for FileUtils.forceMkdir doesn't say what is supposed to happen
> if a directory already exists with the same path.
> It does (misleadingly) say that if a file already exists, it fails. I
> interpreted this to mean that a directory would also fail, as it said *file*
> and not *normal file*. However in reality, if the directory already exists,
> the method passes.
> For clarity it should say that it succeeds if the directory already exists,
> and should probably also explicitly say "normal file" instead of just "file",
> as all directories are files.
> Also, internally, I notice it is checking for File.isFile() whereas our
> existing method for implementing the same thing is checking
> !File.isDirectory(). On some filesystems, a file can be both a directory and
> a normal file, and in this situation I would expect the method to pass,
> whereas with Commons' implementation it would fail. Maybe this is a trip-up
> because Sun themselves documented "normal file" as meaning "something which
> is not a directory", which is going to break the moment someone runs
> something on a more exotic filesystem. :-(
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.