RFR: 8303923: ZipOutStream::putEntry should include an apiNote to indicate that the STORED compression method should be used when writing directory entries [v3]
Lance Andersen
lancea at openjdk.org
Thu Mar 23 16:49:56 UTC 2023
On Thu, 23 Mar 2023 07:16:32 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
> > The example code works without setting the compressed size on the entry?
>
> Yes, this is the minimal code required and is also how the `jar` tool does it.
>
> The current behaviour does feel a bit underspecified though. In the `ZipEntry` and `ZipOutputStream` documentation, `getCompressedSize` documents that: 'In the case of a stored entry, the compressed size will be the same as the uncompressed size of the entry.'
>
> Perhaps a similar note should be addded to `ZipEntry.setCompressedSize`, documenting that this method need not be called for STORED entries.
>
> @LanceAndersen what do you think?
More thought needs to be given to a clarification as any validation of the ZipEntry values once set are done in ZipOutPutStream. There is some validation done in ZipEntry::setSize and ZipEntry::setCRC but nothing to validate the note you point out in ZipEntry::getCompressedSize.
So yes, we should probably add further clarification but lets address as a separate issue
-------------
PR Comment: https://git.openjdk.org/jdk/pull/12899#issuecomment-1481532491
More information about the core-libs-dev
mailing list