RFR: 8285517: System.getenv() returns unexpected value if environment variable has non ASCII character [v2]
Naoto Sato
naoto at openjdk.java.net
Tue May 3 18:39:07 UTC 2022
On Tue, 3 May 2022 17:30:34 GMT, Ichiroh Takiguchi <itakiguchi at openjdk.org> wrote:
>> 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.
Sorry if my comment was unclear. I meant to not create a shell script (shell scripts in the test are discouraged), but to re-use the main class twice, invoking with different arguments to main(), as both creating a testJvm process (one for eucjp jvm, and the other for Start).
>> 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.
Do we need to verify the intermediate byte encoding? Could we simply compare the text given to environ.put() in Start process and System.getenv() in Verify process match?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8378
More information about the core-libs-dev
mailing list