On Mon, 23 Mar 2026 15:04:58 GMT, Eirik Bjørsnøs <[email protected]> wrote:
>> Please review this PR which improves validation of unmappable characters in >> ZipEntry names and comments in the `ZipFileOutputStream` API. >> >> Currently, `ZipFileOutputStream:putNextEntry` throws >> `IllegalArgumentException` when rejecting a path or entry name which cannot >> be encoded with the given charset. Similarly, failed encoding of CEN >> ZipEntry comments fails in `finish` where only `IOException is specified. >> >> This PR adds early validation to `ZipOutputStream::putNextEntry` where a >> failed validation now throws `ZipException` a specified. We now also reject >> unmappable ZipEntry comments in a similar fashion. >> >> New tests are added in the ZipFileOutputStream area to verify that the API >> throw exceptions according to specifications when faced with unmappable >> characters. > > Eirik Bjørsnøs has updated the pull request incrementally with one additional > commit since the last revision: > > Avoid encoding name into bytes twice in putNextEntry, then again in writeLOC `ZipOutputStream.setComment` will fail with IAE if the string is not encodable. We should update its IAE clause to include this case. ------------- PR Comment: https://git.openjdk.org/jdk/pull/30319#issuecomment-4136430465
