On Thu, 19 Mar 2026 17:24:39 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.

This pull request has now been integrated.

Changeset: 3459f6b1
Author:    Eirik Bjørsnøs <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/3459f6b124c34f3187050495e34c690c017a0687
Stats:     94 lines in 2 files changed: 90 ins; 1 del; 3 mod

8380452: ZipOutputStream::putNextEntry(ZipEntry) throws unspecified 
IllegalArgumentException for unmappable entry name

Reviewed-by: jpai, lancea, alanb

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

PR: https://git.openjdk.org/jdk/pull/30319

Reply via email to