JDK-8254840 : Release Note: Refine ZipOutputStream.putNextEntry() to Recalculate ZipEntry's Compressed Size
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 16
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2020-10-15
  • Updated: 2021-12-03
  • Resolved: 2020-10-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16Resolved
Description
Prior to JDK 16, `ZipOutputStream.putnextEntry()` would not recalculate the compressed size for a compressed (DEFLATED) entry. This could result in the ZipException, "invalid entry compressed size", being thrown if the current ZLIB implementation being used when `ZipOutputStream.putNextEntry()` was called  differed from the implementation  at the time when the entry was added to the original ZIP file.

Starting with JDK 16, if the compressed size has not been explicitly set with the `ZipEntry.setCompressedSize(long)` method when writing a compressed (DEFLATED) entry, then the compressed size is set to the actual compressed size after deflation.