You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
A new JDK fix in JDK 24+10 causes NullPointerException when some Locale classes are being used in a native image.
Steps to reproduce the issue
Build Graal master (revision 152bcf2f6a4d1080b707258d4a5fdf27f51f4c69) with JDK 24+10 or better.
Generate a native image from the provided reproducer.
Run the reproducer.
Reproducer code
$ cat TestLocale.java
import java.util.Locale;
public class TestLocale {
public static void main(String[] args) {
Locale some = Locale.of("de", "AT");
System.out.println("Country: " + some.getDisplayCountry());
}
}
$ $GRAALVM_HOME/bin/java TestLocale.java
Country: Austria
Describe GraalVM and your environment:
GraalVM master built from source
JDK major version: 24+10
OS: Linux
Architecture: AMD64
More details
When running the produced native image one can observe an NPE:
$ ./loc-test
Exception in thread "main" java.lang.NullPointerException
at java.base@24-beta/sun.util.locale.provider.LocaleResources.getLocaleName(LocaleResources.java:294)
at java.base@24-beta/sun.util.locale.provider.LocaleNameProviderImpl.getDisplayString(LocaleNameProviderImpl.java:198)
at java.base@24-beta/sun.util.locale.provider.LocaleNameProviderImpl.getDisplayCountry(LocaleNameProviderImpl.java:147)
at java.base@24-beta/java.util.Locale$LocaleNameGetter.getObject(Locale.java:2652)
at java.base@24-beta/java.util.Locale$LocaleNameGetter.getObject(Locale.java:2634)
at java.base@24-beta/sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObjectImpl(LocaleServiceProviderPool.java:284)
at java.base@24-beta/sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObject(LocaleServiceProviderPool.java:245)
at java.base@24-beta/java.util.Locale.getDisplayString(Locale.java:2144)
at java.base@24-beta/java.util.Locale.getDisplayCountry(Locale.java:2130)
at java.base@24-beta/java.util.Locale.getDisplayCountry(Locale.java:2109)
at TestLocale.main(TestLocale.java:5)
at java.base@24-beta/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Building GraalVM master on the same revision with JDK 24+9 works. We've determined that the issue is being caused by the JDK 24 fix new in build 10: https://bugs.openjdk.org/browse/JDK-8337603
The text was updated successfully, but these errors were encountered:
The JDK's StaticProperty class uses a default of the empty string
for the java.locale.useOldISOCodes static property. Ensure to also
use the empty string as the default in substratevm avoiding the
NullPointerException.
Closes: oracle#9526
fniephaus
changed the title
[24.2] NPE in Locale processing with JDK 24+10 and better
[GR-57624] [24.2] NPE in Locale processing with JDK 24+10 and better
Aug 27, 2024
Describe the issue
A new JDK fix in JDK
24+10
causesNullPointerException
when some Locale classes are being used in a native image.Steps to reproduce the issue
152bcf2f6a4d1080b707258d4a5fdf27f51f4c69
) with JDK 24+10 or better.Reproducer code
Describe GraalVM and your environment:
More details
When running the produced native image one can observe an NPE:
Building GraalVM master on the same revision with
JDK 24+9
works. We've determined that the issue is being caused by the JDK 24 fix new in build 10: https://bugs.openjdk.org/browse/JDK-8337603The text was updated successfully, but these errors were encountered: