RFR: 8372155: RealeaseInfoPlugin doesn't handle input file as UTF-8 properly
Severin Gehwolf
sgehwolf at openjdk.org
Thu Nov 20 10:26:01 UTC 2025
On Wed, 19 Nov 2025 17:47:07 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> Please review this simple fix to `jlink`'s `--release-info` plugin to handle non-ASCII in vendor strings. The JDK build uses UTF-8 encoding for the produced `release` file that is being passed to `jlink` at build-time via the `--release-info` plugin. However, the plugin internally uses `java.util.Properties.load(InputStream)` API which assumes `ISO-8859-1` encoding of the input stream. The proposed fix is to use the `java.util.Prorperties.load(Reader)` API instead and pass it an `InputStreamReader` with `UTF-8` encoding.
>
> Testing:
> - [x] GHA
> - [x] `test/jdk/tools/jlink` tests including the new reg-test which fails prior and passes after the fix.
>
> Thoughts?
Thanks for the review.
> Hello Severin, would it better to (even) specify the expectations of the `--release-info` jlink plugin and what encoding it expects for the file content?
IIUYC, you'd like to have the help text amended for `--release-info` to say it expects the input file in `UTF-8`? Is that what you are saying?
IMO it would be best for `--release-info` to not only require a file as an option but also the encoding. It could perhaps default to `UTF-8`. @AlanBateman Any thoughts on this?
> I might be wrong, but even with the use of `UTF-8` for reading the given file (like proposed in this PR), it may not guarantee that it is the right Charset to use for that file.
True. If somebody passes an ISO-8859-1 (or any non-utf8) encoded file to `--release-info` it would break for any non-ASCII characters.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28399#issuecomment-3557105439
More information about the core-libs-dev
mailing list