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

Ichiroh Takiguchi itakiguchi at openjdk.java.net
Fri May 6 14:33:06 UTC 2022


On Thu, 5 May 2022 01:34:48 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> 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 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?

Modified.
But I'm not sure, it's expected one.

> 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.

Use `shouldNotContain()` to find the error message.

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

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


More information about the core-libs-dev mailing list