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

Reviewed-by: alanb, martin
This commit is contained in:
Xueming Shen 2018-07-09 13:08:30 -07:00
parent 051f4ed627
commit 84234d1abb
2 changed files with 58 additions and 4 deletions

View file

@ -582,7 +582,9 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
uctime > UPPER_UNIXTIME_BOUND) {
elen += 36; // NTFS time total 36 bytes
} else {
elen += 9; // headid(2) + sz(2) + flag(1) + mtime (4)
elen += 5; // headid(2) + sz(2) + flag(1)
if (e.mtime != null)
elen += 4; // + mtime (4)
}
}
writeShort(elen);