Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-435

Javadoc of methods in FileUtils does not mention thrown IllegalArgumentException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.4
    • 2.5
    • None

    Description

      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:

          1. 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()) {

      Attachments

        Activity

          People

            Unassigned Unassigned
            dominik.stadler@gmx.at Dominik Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: