Commons IO
  1. Commons IO
  2. IO-37

[io] Tests fail on Windows 2000 due to File lastModified() behaviour


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
    • Environment:

      Operating System: Windows 2000
      Platform: Other


      The following JUnit test cases fail when running on Windows 2000 (JDK 1.4.2_05)

      According to the javadoc for the setLastModified() method "All
      platforms support file-modification times to the nearest second, but some
      provide more precision"

      1) FileFilterTestCase's testAgeFilter() method appears to be failing because
      the lastModified date is being rounded up to the nearest second - but the spin
      () method is only waiting until the system time is later. I'm attaching a patch
      so that the spin() method waits until the system time is after the modification
      date/time of the file.

      2) FileUtilsFileNewerTestCase seems to have a couple of problems:

      • The testIsFileNewer() method appears to be failing because calling
        setLastModified() seems to be rounding up to the nearest two seconds, so the
        check on the temporary file lastModified time after it has been set fails.
        Changing testIsFileNewer() to use two seconds rather than one resolves this and
        I found the following bug which appears to back this up:

      • The testIsFileNewerImaginaryFile() method appears to be failing because
        setting the lastModified to zero seems to be ignored. This is also mentioned in
        the above bug. Passing the actual temporary file's modifiedDate rather than
        zero resolves this.


        Niall Pemberton created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 38130 12342832
        Henri Yandell made changes -
        Project Commons [ 12310458 ] Commons IO [ 12310477 ]
        Key COM-2680 IO-37
        Assignee Jakarta Commons Developers Mailing List [ ]
        Affects Version/s 1.1 Final [ 12311652 ]
        Component/s IO [ 12311117 ]
        Henri Yandell made changes -
        Affects Version/s 1.1 Final [ 12311746 ]
        Henri Yandell made changes -
        Fix Version/s 1.2 [ 12311767 ]
        Bugzilla Id 38130
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12371737 ] Default workflow, editable Closed status [ 12601859 ]


          • Assignee:
            Niall Pemberton
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: