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

Jaikiran Pai jpai at openjdk.org
Sun Mar 23 09:28:40 UTC 2025


On Sat, 22 Mar 2025 17:17:26 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/zip/ZipFile.java line 86:
>> 
>>> 84:     private final String fileName;     // name of the file
>>> 85:     // the ZipCoder instance is derived from the Charset passed to the ZipFile constructor
>>> 86:     // and will be used for decoding the non-UTF-8 entry names and the ZIP file comment.
>> 
>> Maybe a personal preference, and perhaps I'm too intimitely familiar with this code, but I feel this field comment is overly verbose. 
>> 
>> Not sure how useful it is to document what the instance is derived from, it's not something we do for other fields and maintainers can always inspect the constructor to find out how it's being assigned.
>> 
>> The "non-UTF-8" part is correct, but I feel this information belongs closer to where that decision is made, not here.
>> 
>> The ZipCoder is used when decoding entry comments as well, so the current comment is not fully correct.
>> 
>> Perhaps something like "Used for decoding binary encoded names and comments into strings" would do?
>
> I agree, it just needs to say the ZipCoder for entry names and comments when not using UTF-8.

Sorry, I missed updating this comment in the previous iteration. I've now updated the PR to match Alan's suggestion.

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

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


More information about the core-libs-dev mailing list