RFR: 8260010: UTF8ZipCoder not thread-safe since JDK-8243469

eirbjo github.com+300291+eirbjo at openjdk.java.net
Wed Jan 20 12:55:58 UTC 2021

On Wed, 20 Jan 2021 12:21:21 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> This patch resolves a thread-safety issue where the singleton UTF8ZipCoder is erroneously using a shared CharsetDecoder when the fast-path fails. It needs to go via JLA.newStringUTF8NoRepl like before JDK-8243469
> This should resolve a rare issue when doing a lot of jar scanning in parallel on jar/zip files (with at least some non-ASCII entries), but I've not managed to create a test that reliably reproduce the issue.

src/java.base/share/classes/java/util/zip/ZipCoder.java line 229:

> 227:                     // Non-ASCII, fall back to decoding a String
> 228:                     String s = JLA.newStringUTF8NoRepl(a, end - len, end);
> 229:                     h = s.hashCode();

Would it be possible to call normalizedHash(String name) here?


PR: https://git.openjdk.java.net/jdk/pull/2163

More information about the core-libs-dev mailing list