[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: File last modified diff behavior

jaikiran do-not-reply at jboss.com
Tue Apr 14 06:56:06 EDT 2009


anonymous wrote : 
  | File updateFile = new File(rootFile, "test.jsp");
  | assertTrue(updateFile.setLastModified(System.currentTimeMillis()));

As per the javadoc of java.io.File.setLastModified:

anonymous wrote :      All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the lastModified() method will return the (possibly truncated) time argument that was passed to this method.
  | 
  | 
So unless there is a difference of 1 second, there's no guarantee of that test case passing on all platforms. I guess the test case could be changed to add some delay before updating the last modified timestamp on the original file.




View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225317#4225317

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225317



More information about the jboss-dev-forums mailing list