On Wed, 8 Apr 2026 04:40:07 GMT, Eirik Bjørsnøs <[email protected]> wrote:
>> Please review this PR which improves validation of unmappable characters in
>> strings passed to `ZipFileSystem::getPath` and `ZipPath::resolve`.
>>
>> Currently, `ZipFileSystem::getPath` and `ZipPath::resolve` throw
>> `IllegalArgumentException` when rejecting a path or entry name which cannot
>> be encoded with the given charset. This PR adds validation to
>> `ZipFileSystem::getBytes` where a failed validation now throws
>> `InvalidPathException`.
>>
>> As far as I can tell, the transitive call sites of `ZipFileSystem::getBytes`
>> ends up being `ZipFileSystem::getPath` and `ZipPath::resolve`.
>>
>> A new test is added in the ZipFS area to verify that the APIs throw
>> exceptions according to specifications when faced with unmappable characters
>> in primary or secondary path string components.
>>
>> This PR is similar to a recently integrated change in the `ZipOutputStream`
>> API via #30319.
>>
>> A CSR has been drafted.
>
> Eirik Bjørsnøs has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Add missing indentation to ZipFileSystem::getBytes try block
src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java line 1252:
> 1250: return zc.getBytes(name);
> 1251: } catch (IllegalArgumentException e) {
> 1252: throw new InvalidPathException(name, "unmappable character
> in path name");
InvalidPathException extends IllegalArgumentException so there should be no
compatibly impact to code that has been handling the IAE.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30584#discussion_r3056214986