RFR: 8285517: System.getenv() returns unexpected value if environment variable has non ASCII character [v2]

Naoto Sato naoto at openjdk.java.net
Mon May 2 21:15:38 UTC 2022


On Sun, 1 May 2022 04:51:17 GMT, Ichiroh Takiguchi <itakiguchi at 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

test/jdk/java/lang/System/i18nEnvArg.java line 63:

> 61:     }
> 62: 
> 63:     public static class Start {

Do we need `Start` class? Can it be merged with the parent to reduce the complexity?

test/jdk/java/lang/System/i18nEnvArg.java line 87:

> 85:                 System.getProperty("java.class.path"),
> 86:                 "i18nEnvArg$Verify",
> 87:                 EUC_JP_TEXT);

Can utilize `ProcessTools` class.

test/jdk/java/lang/System/i18nEnvArg.java line 130:

> 128:             environ_mid.setAccessible(true);
> 129:             byte[][] environ = (byte[][]) environ_mid.invoke(null,
> 130:                 (Object[])null);

I am not sure I like this piece, invoking a package private method of `ProcessEnvironment` class. Can we simply verify the result of `System.getenv(EUC_JP_TEXT)`?

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

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


More information about the core-libs-dev mailing list