RFR: 8285517: System.getenv() returns unexpected value if environment variable has non ASCII character [v2]
Ichiroh Takiguchi
itakiguchi at openjdk.java.net
Tue May 3 17:34:22 UTC 2022
On Mon, 2 May 2022 20:50:11 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 63:
>
>> 61: }
>> 62:
>> 63: public static class Start {
>
> Do we need `Start` class? Can it be merged with the parent to reduce the complexity?
I'm not sure, it expected one...
I created i18nEnvArg.sh for start-up, then add `@modules jdk.charsets` and remove `i18nEnvArg$Start` class.
> 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.
Use `ProcessTools`
> 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)`?
I think 3 processes required for this testing.
1. Start test process on ja_JP.eucjp locale
2. Set the test data by encoder
3. Verify the encoded data by decoder
To verify the encoded data, I think I need to check the byte data.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8378
More information about the core-libs-dev
mailing list