8295232: "java.locale.useOldISOCodes" property is read lazily

Reviewed-by: lancea, bpb, iris, rriggs, coffeys
This commit is contained in:
Naoto Sato 2022-10-13 16:18:53 +00:00
parent 3b3438752c
commit 4224d45132
3 changed files with 70 additions and 3 deletions

View file

@ -33,8 +33,8 @@
package sun.util.locale;
import jdk.internal.misc.CDS;
import jdk.internal.util.StaticProperty;
import jdk.internal.vm.annotation.Stable;
import sun.security.action.GetPropertyAction;
import java.lang.ref.SoftReference;
import java.util.StringJoiner;
@ -101,9 +101,10 @@ public final class BaseLocale {
/**
* Boolean for the old ISO language code compatibility.
* The system property "java.locale.useOldISOCodes" is not security sensitive,
* so no need to ensure privileged access here.
*/
private static final boolean OLD_ISO_CODES = GetPropertyAction.privilegedGetProperties()
.getProperty("java.locale.useOldISOCodes", "false")
private static final boolean OLD_ISO_CODES = StaticProperty.javaLocaleUseOldISOCodes()
.equalsIgnoreCase("true");
// This method must be called with normalize = false only when creating the