Bug in File.getLastModified()

Ricardo Almeida ric.almeida at gmail.com
Fri Mar 31 08:28:53 UTC 2017

Hi all,

I agree with Sean, as said in the bug. The reason we have in the
documentation that it can be possibly truncated is most likely related
to older linux's that wouldn't support it... If the data is there and
available, why explicitly truncate it?

Also note that the workaround also doesn't work in Ubuntu with Oracle JDK 8u121.

Regarding causing subtle bugs, I believe current behavior can cause
more issues... As that was the reason why I open this bug. Everything
was working fine in the most developers machines (windows) and bugs
occurred in production (linux with oracle jdk)...

Ricardo Almeida

On 31 March 2017 at 01:49, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> As noted in [1], it looks like the specification [2] already dealt with the
> situation via the "possibly truncated" phrase:
> "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.”
> Given the existence of a workaround and the possibility of causing subtle
> bugs (as noted by Stuart in the issue comments [1]), I would be inclined to
> resolve this as Not an Issue.
> Thanks,
> Brian
> On Mar 30, 2017, at 5:47 AM, Seán Coffey <sean.coffey at oracle.com> wrote:
> I see that JDK-8177809 [1] has been logged.
> […]
> [1] https://bugs.openjdk.java.net/browse/JDK-8177809
> [2]
> http://download.java.net/java/jdk9/docs/api/java/io/File.html#setLastModified-long-

More information about the core-libs-dev mailing list