RFR: 8357404: jpackage should attempt to get a package version from the JDK's release file if the --version option is not specified [v6]

Alexey Semenyuk asemenyuk at openjdk.org
Wed Feb 4 03:39:11 UTC 2026


On Tue, 3 Feb 2026 23:06:31 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RuntimeVersionReader.java line 47:
>> 
>>> 45:             String version = props.getProperty("JAVA_VERSION");
>>> 46:             if (version != null) {
>>> 47:                 version = version.replaceAll("^\"|\"$", "");
>> 
>> Why does this function filter the value of the "JAVA_VERSION" property?
>> 
>> It should not do any filtering; it should just read the value as its name suggests.
>> 
>> Filering is platform-specific and should be a separate method.
>
> For some reason `JAVA_VERSION` is set to quoted string and `getProperty()` will return `"27"` instead of `27`. I think `"` is not truly part of version string and `replaceAll()` removes it. I do not think that removing leading and trailing `"` should be platform specific.

Please add a comment explaining this.
We also need a test case where the property value is not enclosed in double quotes.

Makes me wonder: is java.util.Properties the correct choice for reading the "release" file?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29260#discussion_r2762011038


More information about the core-libs-dev mailing list