RFR JDK-8206389: JarEntry.setCreation/LastAccessTime without setLastModifiedTime causes Invalid CEN header

Xueming Shen xueming.shen at oracle.com
Fri Jul 6 23:46:09 UTC 2018


Hi

Please help review the changeset for JDK-8206389

issue: https://bugs.openjdk.java.net/browse/JDK-8206389
webrev: http://cr.openjdk.java.net/~sherman/8206389/webrev

Cause: ZipOutputStream.writeCEN().writeCEN() incorrectly calculate the 
length
of bytes needed for the  "unix timestamps" when the "last modified time" is
NOT set. The info-zip spec specifies that

           The central-header extra field contains the modification time 
only,
           or no timestamp at all.  TSize is used to flag its presence or
           absence.  But note:

So in this case, when "creation time", "last access time" are set but the
"last modified time" is not. only the "tag", "size" and "flag" should be 
output to
the extra field, no real "mtime" timestamp, so the total size of the 
bytes needed
is 5, not 9.

Thanks,
Sherman



More information about the core-libs-dev mailing list