RFR: 8347712: IllegalStateException on multithreaded ZipFile access with non-UTF8 charset [v6]

Eirik Bjørsnøs eirbjo at openjdk.org
Mon Mar 24 15:18:14 UTC 2025


On Mon, 24 Mar 2025 00:58:18 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - improve code comment for ZipFile.zipCoder
>>  - Alan's suggestion - change code comment about Source class being thread safe
>>  - Alan's suggestion - trim the javadoc of (internal) ZipCoder class
>
> src/java.base/share/classes/java/util/zip/ZipCoder.java line 44:
> 
>> 42:  * <p>
>> 43:  * The {@code ZipCoder} for UTF-8 charset is thread safe, {@code ZipCoder}
>> 44:  * for other charsets require external synchronization.
> 
> I think the "thread safe" feature is already implied by the comment on UTF8: "Encoding/decoding is stateless". So I recommend just mentioning that a ZipCoder may carry states, and a ZipCoder obtained from `ZipCoder.get` should only be used locally.

I agree with @liach here. The fact that one ZipCoder is stateless and thread-safe is a class-internal implementation detail and not information which any call site of this API makes use of.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23986#discussion_r2010360548


More information about the core-libs-dev mailing list