You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Aleksandr Dubinsky (JIRA)" <ji...@apache.org> on 2015/10/28 10:14:27 UTC

[jira] [Commented] (IO-449) FileUtils.sizeOfDirectory(File) throws IllegalArgumentException on symlink that does not exist

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

Aleksandr Dubinsky commented on IO-449:
---------------------------------------

I'm not sure the explanation and comment is correct. This isn't about symlinks, and I don't think `isSymlink` throws IllegalArgumentException.

This fixes a race condition when the directory is being modified as its size is being calculated.

This also underlines a problem with FileUtils.sizeOf(File). It shouldn't throw `IllegalArgumentException`, it should throw a checked `IOException` when the file isn't found because the caller can't prevent the exception and he should be reminded to check for it.

> FileUtils.sizeOfDirectory(File) throws IllegalArgumentException on symlink that does not exist
> ----------------------------------------------------------------------------------------------
>
>                 Key: IO-449
>                 URL: https://issues.apache.org/jira/browse/IO-449
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5
>            Reporter: Steven Christou
>         Attachments: IO-449.diff
>
>
> FileUtils.isSymlink(File) will throw an IllegalArgumentException if the symbolic link does not exist. FileUtils.sizeOfDirectory(File) ignores any exceptions that are from the symbolic link. I added another catch to ignore IllegalArgumentException.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)