Remove incorrect @throws NoSuchFileException from FileUtils.java

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: 17, 21, 25
    • Component/s: core-libs
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Generic / MacOS / Java 21

      A DESCRIPTION OF THE PROBLEM :
      FileUtils.java `deleteFileIfExistsWithRetry` method documentation states "No exception thrown if file doesn't exist", while the @throws clause lists NoSuchFileException.

      The `deleteFileIfExistsWithRetry` method at lines 98-110 has documentation stating "No exception thrown if file doesn't exist" in the first sentence. The `@throws` clause at line 104 declares `NoSuchFileException` may be thrown. The implementation checks `Files.notExists(path)` before calling `deleteFileWithRetry0(path)`. If `Files.notExists(path)` returns true, `deleteFileWithRetry0` is not called and no exception is thrown. The documentation contradicts itself between the first sentence and the `@throws` clause.

      REGRESSION : Last worked in version 21.0.9-oracle

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      N/A - Documentation analysis only.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The documentation is expected to consistently state whether `NoSuchFileException` can be thrown when the file does not exist.

      ACTUAL -
      The first sentence states no exception is thrown, while the `@throws` clause lists `NoSuchFileException` as a possible exception.


            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: