NIO Files.getLastModifiedTime() returns incorrect value for some ZIP-entries

Viewed 107

When I print the modified date of some files inside some ZIP-files, the Files.getLastModifiedTime() appears to return the current time. I've checked the date of the file in question with custom file managers, and they report the correct date.

I don't have an example zip-file for now, but this happens with relatively many zip-files.

Here's the code:

Path path = Paths.get("C:/example.zip");
try (FileSystems jarFS = FileSystems.newFileSystem(path, Collections.<String, Object>emptyMap())) {
    Path resourcePath = jarFS.getPath("testfile.foo"); 
    FileTime fileTime = Files.getLastModifiedTime(resourcePath);
    System.out.println(fileTime);
}

Anyone have ideas why the correct last-modified time is not always reported?

0 Answers
Related