RFR: 7904021: Parsing group files(TEST.GROUPS) on non-UTF-8 encoding platforms fails with java.nio.charset.MalformedInputException
Christian Stein
cstein at openjdk.org
Mon Jun 9 20:50:42 UTC 2025
On Thu, 5 Jun 2025 04:35:14 GMT, Pasam Soujanya <duke at openjdk.org> wrote:
> Parsing group files(TEST.GROUPS) on non-UTF-8 encoding platforms fails with java.nio.charset.MalformedInputException.
>
> Error:
> Error: Cannot read group files for /test/jdk: java.nio.charset.MalformedInputException: Input length = 1
> ---------
> ### 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
>
> ### Error
> ⚠️ The pull request body must not be empty.
>
> ### Integration blocker
> ⚠️ Title mismatch between PR and JBS for issue [CODETOOLS-7904021](https://bugs.openjdk.org/browse/CODETOOLS-7904021)
>
>
>
> ### 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>
Looking at the former implementation, without NIO API usage, the file read by those methods were assumed to be encoded in `ISO 8859-1`. Defaulting to `UTF-8` was a breaking change, although storing files in `UTF-8` nowadays is a common pattern.
Using `Charset.defaultCharset()` as proposed in the pull request introduces yet another behaviour. Maybe better? Another solution would be to revert to use the original `ISO 8859-1`. 🤔
-------------
PR Comment: https://git.openjdk.org/jtreg/pull/267#issuecomment-2956997051
More information about the jtreg-dev
mailing list