Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8295232

"java.locale.useOldISOCodes" property is read lazily

XMLWordPrintable

    • b18
    • 20
    • b20
    • Verified

      The tests validate "https://download.java.net/java/early_access/jdk20/docs/api/java.base/java/util/Locale.html"

      "For the backward compatible behavior, the system property java.locale.useOldISOCodes reverts the behavior back to that of before Java SE 17. If the system property is set to true, those three current language codes are mapped to their backward compatible forms. The property is only read at Java runtime startup and subsequent calls to System.setProperty() will have no effect."

      So the tests are providing the property during JVM start and also trying to override programmatically using System.setProperty() to prove that the later does not have any effect.

      But JDK20-b18 looks breaks this expectation.

      Please find a stand alone code to demonstrate the problem.

      Results :
      run with b18
      /scratch/jdk-cache/20/18/jdk-20/bin/java -Djava.locale.useOldISOCodes=true ISOCodeTest
      Expected that newcode mapped to old

      run with b17
      /scratch/jdk-cache/20/17/jdk-20/bin/java -Djava.locale.useOldISOCodes=true ISOCodeTest
      Expected

      Possible cause :
      All I can suspect is - sun.util.locale:BaseLocale is loaded lazily from b18 where the "java.locale.useOldISOCodes" property is read.

            naoto Naoto Sato
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: