On Thu, 20 Nov 2025 11:05:59 GMT, Severin Gehwolf <[email protected]> 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?
>
> Severin Gehwolf has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Specify that the input file shall be UTF-8

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
 line 111:

> 109:                 // --release-info <file>
> 110:                 Properties props = new Properties();
> 111:                 try (InputStreamReader isr = new InputStreamReader(new 
> FileInputStream(operation), "UTF-8")) {

`try (Reader reader = Files.newBufferedReader(Path.of(operation)))` for 
something shorter.

test/jdk/tools/jlink/plugins/ReleaseInfoPluginTest.java line 74:

> 72:         var release = image.resolve("release");
> 73:         Properties props = new Properties();
> 74:         try (InputStreamReader isr = new InputStreamReader(new 
> FileInputStream(release.toFile()), "UTF-8")) {

Same here, the new APIs always use UTF-8.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28399#discussion_r2545889489
PR Review Comment: https://git.openjdk.org/jdk/pull/28399#discussion_r2545893876

Reply via email to