Author: tn
Date: Wed Jul 16 21:15:39 2014
New Revision: 1611192

URL: http://svn.apache.org/r1611192
Log:
[IO-435] Document thrown IllegalArgumentException in FileUtils. Thanks to 
Dominik Stadler.

Modified:
    commons/proper/io/trunk/pom.xml
    commons/proper/io/trunk/src/changes/changes.xml
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
    
commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java

Modified: commons/proper/io/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/pom.xml?rev=1611192&r1=1611191&r2=1611192&view=diff
==============================================================================
--- commons/proper/io/trunk/pom.xml (original)
+++ commons/proper/io/trunk/pom.xml Wed Jul 16 21:15:39 2014
@@ -205,6 +205,9 @@ file comparators, endian transformation 
       <name>Ian Springer</name>
     </contributor>
     <contributor>
+      <name>Dominik Stadler</name>
+    </contributor>
+    <contributor>
       <name>Masato Tezuka</name>
     </contributor>
     <contributor>

Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1611192&r1=1611191&r2=1611192&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Wed Jul 16 21:15:39 2014
@@ -47,6 +47,11 @@ The <action> type attribute can be add,u
   <body>
     <!-- The release date is the date RC is cut -->
     <release version="2.5" date="2014-??-??" description="New features and bug 
fixes.">
+      <action issue="IO-435" dev="tn" type="fix" due-to="Dominik Stadler">
+         Document that FileUtils.deleteDirectory, directoryContains and 
cleanDirectory
+         may throw an IllegalArgumentException in case the passed directory 
does not
+         exist or is not a directory. 
+      </action>
       <action issue="IO-426" dev="ggregory" type="add">
          Add API IOUtils.closeQuietly(Closeable...)
       </action>

Modified: 
commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1611192&r1=1611191&r2=1611192&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java 
(original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java 
Wed Jul 16 21:15:39 2014
@@ -1557,6 +1557,7 @@ public class FileUtils {
      *
      * @param directory  directory to delete
      * @throws IOException in case deletion is unsuccessful
+     * @throws IllegalArgumentException if {@code directory} does not exist or 
is not a directory
      */
     public static void deleteDirectory(final File directory) throws 
IOException {
         if (!directory.exists()) {
@@ -1628,6 +1629,8 @@ public class FileUtils {
      * @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 {@code directory} is null or not a directory.
      * @since 2.2
      * @see FilenameUtils#directoryContains(String, String)
      */
@@ -1662,6 +1665,7 @@ public class FileUtils {
      *
      * @param directory directory to clean
      * @throws IOException in case cleaning is unsuccessful
+     * @throws IllegalArgumentException if {@code directory} does not exist or 
is not a directory
      */
     public static void cleanDirectory(final File directory) throws IOException 
{
         if (!directory.exists()) {

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java?rev=1611192&r1=1611191&r2=1611192&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
 Wed Jul 16 21:15:39 2014
@@ -2185,6 +2185,15 @@ public class FileUtilsTestCase extends F
         assertEquals(expectedValue, resultValue);
     }
 
+    public void testDeleteDirectoryWithNonDirectory() throws Exception {
+        try {
+            FileUtils.deleteDirectory(testFile1);
+            fail();
+        } catch (final IllegalArgumentException ex) {
+            // expected
+        }
+    }
+
     public void testDeleteQuietlyForNull() {
         try {
             FileUtils.deleteQuietly(null);


Reply via email to