Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato 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 applied same kind of patch into jdk17u. The situation was same. $ env LC_ALL=kk_KZ.pt154 ./build/linux-x86_64-server-release/images/jdk/bin/java -showversion Hello.java WARNING: The encoding of the underlying platform's file system is not supported by the JVM: PT154 openjdk version "17.0.1-internal" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1-internal+0-adhoc.jdktest.jdk17u) OpenJDK 64-Bit Server VM (build 17.0.1-internal+0-adhoc.jdktest.jdk17u, mixed mode, sharing) Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.util.ServiceConfigurationError: java.nio.charset.spi.CharsetProvider: Unable to load sun.nio.cs.ext.ExtendedCharsets at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586) ... - PR: https://git.openjdk.java.net/jdk/pull/6282
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato 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.(java.base/String.java:1412) at java.lang.String.(java.base/String.java:1432) at jdk.internal.util.SystemProps$Raw.platformProperties(java.base/Native Method) at jdk.internal.util.SystemProps$Raw.(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.(java.base/String.java:1411) at java.lang.String.(java.base/String.java:1431) at jdk.internal.util.SystemProps$Raw.platformProperties(java.base/Native Method) at jdk.internal.util.SystemProps$Raw.(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
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Thu, 11 Nov 2021 09:40:14 GMT, Ichiroh Takiguchi wrote: > I don't have Oracle Linux... I tried to find out unsupported locales by using > following commands. I used RHEL7.9. In your previous post you used env LC_ALL=kk_KZ.pt154 java Hello.java. Would it be possible to repeat that with JDK 17 and the main-line (latest JDK 18 EA build is okay). I'm wondering if you see the NPE. In any case, our next step here will be to have fallback saved during early startup so that file system and other places don't do the lookup. This seems the sanest way to avoid the recursive initialisation issue. - PR: https://git.openjdk.java.net/jdk/pull/6282
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato 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 don't have Oracle Linux... I tried to find out unsupported locales by using following commands. I used RHEL7.9. $ cat CharsetIsSupported.java import java.nio.charset.Charset; public class CharsetIsSupported { public static void main(String[] args) throws Exception { for(String s : args) { if (!Charset.isSupported(s)) System.out.println(s); } } } $ locale -a | while read LOC; do env LANG=$LOC locale charmap; done | sort -u | xargs ~/jdk-17.0.1/bin/java CharsetIsSupported.java > encoding.lst $ locale -a | while read LOC; do echo -e "$LOC\t\c"; env LANG=$LOC locale charmap; done | grep -f encoding.lst cy_GB ISO-8859-14 cy_GB.iso885914 ISO-8859-14 hy_AM.armscii8 ARMSCII-8 ka_GE GEORGIAN-PS ka_GE.georgianpsGEORGIAN-PS kk_KZ PT154 kk_KZ.pt154 PT154 lg_UG ISO-8859-10 lg_UG.iso885910 ISO-8859-10 tg_TJ KOI8-T tg_TJ.koi8t KOI8-T I tried following command, "sun.jnu.encoding" system property was referred following source code. We may need to care about these files. $ find src -type f | xargs grep '"sun.jnu.encoding"' src/java.base/share/classes/java/lang/System.java:var jnuEncoding = props.getProperty("sun.jnu.encoding"); src/java.base/share/classes/java/lang/System.java: props.getProperty("sun.jnu.encoding")); src/java.base/share/classes/jdk/internal/util/SystemProps.java: put(props, "sun.jnu.encoding", raw.propDefault(Raw._sun_jnu_encoding_NDX)); src/java.base/share/classes/sun/launcher/LauncherHelper.java:private static final String encprop = "sun.jnu.encoding"; src/java.base/share/classes/sun/nio/fs/Util.java: GetPropertyAction.privilegedGetProperty("sun.jnu.encoding"), src/java.base/share/native/libjava/jni_util.h:NO_ENCODING_YET = 0, /* "sun.jnu.encoding" not yet set */ src/java.desktop/share/classes/sun/font/SunFontManager.java: String sysEncoding = System.getProperty("sun.jnu.encoding"); - PR: https://git.openjdk.java.net/jdk/pull/6282
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato 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 Marked as reviewed by iris (Reviewer). - PR: https://git.openjdk.java.net/jdk/pull/6282
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
On Tue, 9 Nov 2021 19:38:01 GMT, Naoto Sato 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 Marked as reviewed by rriggs (Reviewer). - PR: https://git.openjdk.java.net/jdk/pull/6282
Re: RFR: 8275007: Java fails to start with null charset if LC_ALL is set to certain locales [v2]
> 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 - Changes: - all: https://git.openjdk.java.net/jdk/pull/6282/files - new: https://git.openjdk.java.net/jdk/pull/6282/files/0b9f6df3..d3c240c9 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=6282=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk=6282=00-01 Stats: 15 lines in 1 file changed: 15 ins; 0 del; 0 mod Patch: https://git.openjdk.java.net/jdk/pull/6282.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6282/head:pull/6282 PR: https://git.openjdk.java.net/jdk/pull/6282