<i18n dev> RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3]
Naoto Sato
naoto at openjdk.org
Mon Jun 5 21:50:56 UTC 2023
On Fri, 2 Jun 2023 01:07:27 GMT, SUN Guoyun <duke at openjdk.org> wrote:
>> SUN Guoyun has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>>
>> 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared
>
> src/java.base/share/classes/sun/util/locale/BaseLocale.java line 369:
>
>> 367: BaseLocale l = key.holder;
>> 368: BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true);
>> 369: return (new Key(locale)).getBaseLocale();
>
> Perhaps a more rigorous approach would look like this:
> <pre><code class="java">
> BaseLocale locale = new BaseLocale(l.getLanguage(), l.getScript(), l.getRegion(), l.getVariant(), true);
> BaseLocal value = (new Key(locale)).getBaseLocale();
> Reference.reachabilityFence(locale);
> return value;
> </code></pre>
> But the current patch has passed the tests with `-XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot`, so I think the current patch is OK.
I still don't see a clear explanation of how the proposed patch fixes the problem. Also, I would appreciate the reasoning in the comments.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14211#discussion_r1218629550
More information about the i18n-dev
mailing list