On Wed, 4 May 2022 17:09:32 GMT, Ichiroh Takiguchi <itakigu...@openjdk.org> wrote:
>> On JDK19 with Linux ja_JP.eucjp locale, >> System.getenv() returns unexpected value if environment variable has >> Japanese EUC characters. >> It seems this issue happens because of JEP 400. >> Arguments for ProcessBuilder have same kind of issue. > > Ichiroh Takiguchi has updated the pull request incrementally with one > additional commit since the last revision: > > 8285517: System.getenv() returns unexpected value if environment variable > has non ASCII character src/java.base/unix/classes/java/lang/ProcessEnvironment.java line 73: > 71: @SuppressWarnings("removal") > 72: String jnuEncoding = > AccessController.doPrivileged((PrivilegedAction<String>) () > 73: -> System.getProperty("sun.jnu.encoding")); No need to issue `doPrivileged()`, which is deprecated src/java.base/unix/classes/java/lang/ProcessImpl.java line 149: > 147: @SuppressWarnings("removal") > 148: String jnuEncoding = > AccessController.doPrivileged((PrivilegedAction<String>) () > 149: -> System.getProperty("sun.jnu.encoding")); Same here. test/jdk/java/lang/System/i18nEnvArg.java line 70: > 68: Map<String, String> environ = pb.environment(); > 69: environ.clear(); > 70: environ.put("LANG", "ja_JP.eucjp"); There are many duplicate pieces of code here and in the `else` block below. Can you simplify this `if` statement more? test/jdk/java/lang/System/i18nEnvArg.java line 110: > 108: String s = System.getenv(EUC_JP_TEXT); > 109: ByteArrayOutputStream baos = new ByteArrayOutputStream(); > 110: PrintStream ps = new PrintStream(baos); Can utilize try-with-resources pattern. ------------- PR: https://git.openjdk.java.net/jdk/pull/8378