[
https://issues.apache.org/jira/browse/IO-435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Neidhart resolved IO-435.
--------------------------------
Resolution: Fixed
Fix Version/s: 2.5
Fixed in r1611192.
Thanks for the patch and report!
> Javadoc of methods in FileUtils does not mention thrown
> IllegalArgumentException
> --------------------------------------------------------------------------------
>
> Key: IO-435
> URL: https://issues.apache.org/jira/browse/IO-435
> Project: Commons IO
> Issue Type: Improvement
> Affects Versions: 2.4
> Reporter: Dominik Stadler
> Priority: Critical
> Labels: patch
> Fix For: 2.5
>
>
> In some cases IllegalArgumentException is thrown when the given File object
> is a normal file and not a directory, the JavaDoc should reflect this.
> Patch as follows:
> ### Eclipse Workspace Patch 1.0
> #P commons-io
> Index: src/main/java/org/apache/commons/io/FileUtils.java
> ===================================================================
> --- src/main/java/org/apache/commons/io/FileUtils.java (revision
> 1585896)
> +++ src/main/java/org/apache/commons/io/FileUtils.java (working copy)
> @@ -1557,6 +1557,7 @@
> *
> * @param directory directory to delete
> * @throws IOException in case deletion is unsuccessful
> + * @throws IllegalArgumentException if the given directory does not
> exists or is a file
> */
> public static void deleteDirectory(final File directory) throws
> IOException {
> if (!directory.exists()) {
> @@ -1628,6 +1629,7 @@
> * @return true is the candidate leaf is under by the specified
> composite. False otherwise.
> * @throws IOException
> * if an IO error occurs while checking the files.
> + * @throws IllegalArgumentException if the given directory is passed
> null or is not a directory
> * @since 2.2
> * @see FilenameUtils#directoryContains(String, String)
> */
> @@ -1662,6 +1664,7 @@
> *
> * @param directory directory to clean
> * @throws IOException in case cleaning is unsuccessful
> + * @throws IllegalArgumentException if the given directory does not
> exists or is a file
> */
> public static void cleanDirectory(final File directory) throws
> IOException {
> if (!directory.exists()) {
--
This message was sent by Atlassian JIRA
(v6.2#6252)