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

The use of file.exists() is failure prone. Where file.exists() is checked, it should be replaced with the following dual check: exists = ( file.exists() || file.length()>0 )

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.5, 3.x
    • None
    • Utilities
    • All

    Description

      The use of file.exists() is failure prone. In many cases the jvm can report that a file does not exist even when it does. This is due to the caching in the operating system.
      Since file.exists() is prone to report false values, a second check can and should be made to file.length()>0.

      Where file.exists() is checked, it should be replaced with the following dual check:

      A file more reliably exists if: file.exists() || file.length()>0

      Then if the file does not exist, file.length will be 0.

      Attachments

        Activity

          People

            Unassigned Unassigned
            groovemeister Feeling Groovy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified