On Sun, 22 Mar 2026 19:39:44 GMT, Eirik Bjørsnøs <[email protected]> wrote:

> This was discussed with Lance in an earlier comment in this PR. My response 
> there was that this validation needs to happen in `putNextEntry`, must happen 
> before the XEntry is added to xentries list (Vector acually!). Otherwise, the 
> finish / close of the ZipOutputStream will fail during writeCEN when an 
> unmappable comment is encoded. Bad usability to fail during close.
> 
> If we want to reduce the number of encodings I see the following options:
> 
> 1: Capture the encoded byte array after validation in `putNextEntry`, then 
> pass it as a parameter to writeLOC. This way, writeLOC does not have to 
> reencode.

I had not noticed that you had discussed this with Lance. Many concern is with 
long names that we might see a regression but we might not have a good 
benchmark that would see the impact of the duplicate encoding. I think we 
should try to avoid need to encode the name again. I'm not too concerned about 
the comment because I would expect they are rare to see.

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

PR Comment: https://git.openjdk.org/jdk/pull/30319#issuecomment-4111226594

Reply via email to