On Fri, 20 Mar 2026 16:13:33 GMT, Lance Andersen <[email protected]> wrote:

> Apologies for not b being clearer. I would like to avoid the extra 
> try-with-resources in putNextEntry() if we can

I think this validation needs to happen early, in `putNextEntry`, before adding 
the entry  to `xentries`. 

Once the entry get added, it sets it up for processing during 
`ZipOutputStream::close` where `writeCEN` called.

If we want to avoid calling zc.getBytes(e.name) twice, we could capture the 
byte array in putNextEntry, then pass it as a parameter to `writeLOC`. We could 
potentially also capture in the the `XEntry`, but that would add to retained 
heap memory, so I'm slightly reluctant to that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30319#discussion_r2966939308

Reply via email to