RFR: 7904021: Parsing group files using non-UTF-8 encoding fails
Pasam Soujanya
duke at openjdk.org
Tue Jun 10 11:05:43 UTC 2025
On Tue, 10 Jun 2025 10:07:56 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> We make use of jtreg to execute openjdk tests for JDK11/17/21 releases on non-UTF-8 returning platforms. We found latest jtreg code is using Files.newBufferedReader(path) to read group files data(TEST.GROUPS) from openjdk via GroupManager (https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/GroupManager.java#L102C44-L102C61).
>>
>> This code defaults to return BufferedReader as UTF-8 instance. We see discrepancies when using this version of jtreg on non-UTF-8 platforms where defaultCharset() is non-UTF-8(JDK11 and JDK17).
>>
>> Hence, we would like to propose a fix of using default.Charset() with Files.newBufferedWriter(Path path, Charset cs) instead of Files.newBufferedReader(path) and Files.readString(Path) to Files.readString(Path,Charset cs) in below jtreg files :
>> https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/GroupManager.java#L102C44-L102C61
>> https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/ExtraPropDefns.java#L309
>>
>> We've also tested this fix on OpenJDK supported platforms like Linux, Windows, MAC.
>>
>> ---------
>> ### Progress
>> - [ ] Change must be properly reviewed (1 review required, with at least 1 [Reviewer](https://openjdk.org/bylaws#reviewer))
>> - [x] Change must not contain extraneous whitespace
>> - [x] Commit message must refer to an issue
>>
>>
>>
>> ### Reviewing
>> <details><summary>Using <code>git</code></summary>
>>
>> Checkout this PR locally: \
>> `$ git fetch https://git.openjdk.org/jtreg.git pull/267/head:pull/267` \
>> `$ git checkout pull/267`
>>
>> Update a local copy of the PR: \
>> `$ git checkout pull/267` \
>> `$ git pull https://git.openjdk.org/jtreg.git pull/267/head`
>>
>> </details>
>> <details><summary>Using Skara CLI tools</summary>
>>
>> Checkout this PR locally: \
>> `$ git pr checkout 267`
>>
>> View PR using the GUI difftool: \
>> `$ git pr show -t 267`
>>
>> </details>
>> <details><summary>Using diff file</summary>
>>
>> Download this PR as a diff file: \
>> <a href="https://git.openjdk.org/jtreg/pull/267.diff">https://git.openjdk.org/jtreg/pull/267.diff</a>
>>
>> </details>
>> <details><summary>Using Webrev</summary>
>>
>> [Link to Webrev Comment](https://git.openjdk.org/jtreg/pull/267#issuecomment-2942734568)
>> </details>
>
> Please update the title of this PR to read: `Parsing group files using non-UTF-8 encoding fails`
>
> Also, fix the PR body to appear not empty.
@sormuras I've updated the PR title and body. Thank you.
-------------
PR Comment: https://git.openjdk.org/jtreg/pull/267#issuecomment-2958720134
More information about the jtreg-dev
mailing list