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

Naoto Sato naoto at openjdk.java.net
Fri May 6 20:44:45 UTC 2022


On Fri, 6 May 2022 14:29:06 GMT, Ichiroh Takiguchi <itakiguchi at openjdk.org> wrote:

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

I was suggesting `try (ByteArrayOutputStream baos = ...) {` so that no need to clean them up, but I see you removed them. But I prefer not to use `shouldNotContain("ERROR: ")` but to check the return value as before.

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

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


More information about the core-libs-dev mailing list