RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]

Ichiroh Takiguchi itakiguchi at openjdk.java.net
Thu Nov 11 11:02:35 UTC 2021


On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Please review the subject fix. In light of JEP400, Java runtime can/should start in UTF-8 charset if the underlying native encoding is not supported.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Emit a warning on unsupported jnu encoding

I could see following output on my CentOS7.

$ env LC_ALL=kk_KZ.pt154 ~/jdk-17.0.1/bin/java -showversion Hello.java 
Error occurred during initialization of VM
java.lang.NullPointerException
	at java.lang.System.getProperty(java.base/System.java:918)
	at sun.security.action.GetPropertyAction.privilegedGetProperty(java.base/GetPropertyAction.java:106)
	at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:607)
	at java.lang.String.<init>(java.base/String.java:1412)
	at java.lang.String.<init>(java.base/String.java:1432)
	at jdk.internal.util.SystemProps$Raw.platformProperties(java.base/Native Method)
	at jdk.internal.util.SystemProps$Raw.<init>(java.base/SystemProps.java:234)
	at jdk.internal.util.SystemProps.initProperties(java.base/SystemProps.java:54)
	at java.lang.System.initPhase1(java.base/System.java:2089)

$ env LC_ALL=kk_KZ.pt154 ~/jdk-18-b22/bin/java -showversion Hello.java 
Error occurred during initialization of VM
java.lang.NullPointerException
	at java.lang.System.getProperty(java.base/System.java:929)
	at sun.security.action.GetPropertyAction.privilegedGetProperty(java.base/GetPropertyAction.java:106)
	at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:646)
	at java.lang.String.<init>(java.base/String.java:1411)
	at java.lang.String.<init>(java.base/String.java:1431)
	at jdk.internal.util.SystemProps$Raw.platformProperties(java.base/Native Method)
	at jdk.internal.util.SystemProps$Raw.<init>(java.base/SystemProps.java:240)
	at jdk.internal.util.SystemProps.initProperties(java.base/SystemProps.java:54)
	at java.lang.System.initPhase1(java.base/System.java:2100)

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

PR: https://git.openjdk.java.net/jdk/pull/6282


More information about the core-libs-dev mailing list