RFR: 8253952: Refine ZipOutputStream.putNextEntry() to recalculate ZipEntry's compressed size [v2]

Lance Andersen lancea at openjdk.java.net
Sun Oct 11 22:17:11 UTC 2020


On Sun, 11 Oct 2020 17:22:58 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Volker Simonis has refreshed the contents of this pull request, and previous commits have been removed. The incremental
>> views will show differences compared to the previous content of the PR.
>
> src/java.base/share/classes/java/util/zip/ZipOutputStream.java line 189:
> 
>> 187:      * {@code ZipEntry.DEFLATED}) entries when {@link ZipEntry#setCompressedSize(long)}
>> 188:      * has not been explicitly called on the {@code ZipEntry}.
>> 189:      *
> 
> Here's an alternative that might be a bit clearer to readers.
> 
> "When writing a compressed (deflated) entry, and the compressed size has not been explicitly set with the
> setCompressedSize method, then the compressed size written to the entry's data descriptor will be its actual compressed
> size."  I think we should put it after the "The default compression method .." sentence and move the sentence on the
> time stamp to the end.

I don't believe we discuss/reference the data descriptor for a Zip entry (outside of the PKWare Zip specification) so I
am not sure we should reference it in the javadoc.

 Placing the sentence after "The default compression method will be used if no compression method was specified for the
 entry" makes sense

-------------

PR: https://git.openjdk.java.net/jdk/pull/520



More information about the security-dev mailing list