RFR: 8372155: RealeaseInfoPlugin doesn't handle input file as UTF-8 properly

Severin Gehwolf sgehwolf at openjdk.org
Thu Nov 20 12:05:01 UTC 2025


On Thu, 20 Nov 2025 11:07:54 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> > 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?
> 
> It's very likely that tools that read the release file aren't using Properties API so I think having it UTF-8 is best.

The output `$JDK/release` file will be UTF-8 since the `ReleaseInfoPlugin` uses `PrintWriter(BytearrayOutputStream)` to write the content bytes to the `ResourcePoolEntry`. That in-turn uses `UTF-8` since JEP 400 (by means of `Charset.defaultCharset()`.

Question is if it's worth supporting arbitrary *input* encondings for `--release-info <file>` usages. `<file>` is currently in UTF-8 in the JDK build, so went with that expectation. But arguably it could be any other encoding a user chooses. So to make it generic, it's conceivable to allow `--release-info=<file>,<encoding>` or some such to allow non-UTF-8 as input and still do the right thing (Note: output would still be UTF-8). Perhaps it's not worth the trouble?

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

PR Comment: https://git.openjdk.org/jdk/pull/28399#issuecomment-3557623960


More information about the core-libs-dev mailing list