RFR: 8300916: Re-examine the initialization of JNU Charset in StaticProperty [v8]

Mandy Chung mchung at openjdk.org
Thu Jan 26 00:01:21 UTC 2023


On Wed, 25 Jan 2023 20:50:21 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> This issue was found during the review of this PR: https://github.com/openjdk/jdk/pull/12132 where `Charset` class was loaded/initialized at the phase 1 of the startup process. Since `Charset` depends on `StaticProperty`, loading of `Charset` class should be delayed. I basically moved cache for `jnuCharset` into the actual calling locations `ProcessImpl` and `ProcessEnvironment` for unix platforms so that initPhase1() won't initialize `Charset` class.
>> Unrelated, but I replaced `Locale.ENGLISH` with `Locale.ROOT` in the argument of `toLowerCase()`.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Restored doPriv

src/java.base/share/classes/java/nio/charset/Charset.java line 662:

> 660:                 } else {
> 661:                     PrivilegedAction<Charset> pa =
> 662:                         () -> standardProvider.charsetForName(StaticProperty.fileEncoding());

what operation does this do security permission check?  I don't think any.

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

PR: https://git.openjdk.org/jdk/pull/12171


More information about the core-libs-dev mailing list