Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1
-
None
-
None
-
Operating System: Windows 2000
Platform: Other
-
38130
Description
The following JUnit test cases fail when running on Windows 2000 (JDK 1.4.2_05)
FileFilterTestCase
FileUtilsFileNewerTestCase
According to the java.io.File javadoc for the setLastModified() method "All
platforms support file-modification times to the nearest second, but some
provide more precision"
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#setLastModified(long)
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:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4697792
- 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.