RFR: 8287971: Throw exception for missing values in .jpackage.xml

Alexey Semenyuk asemenyuk at openjdk.java.net
Thu Jun 9 02:08:30 UTC 2022


On Thu, 9 Jun 2022 01:21:30 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

> - Warning will be printed if .jpackage.xml has old version number.
>  - Error will be thrown if main-class and app-store values are missing from .jpackage.xml.
>  - Both main-class and app-store are required values for JDK-8286850 and they might be missing if user uses app images generated by previous jpackage version.

If some fields of .jpackage.xml are not valid, the entire file must be considered invalid, not only the invalid fields. This is the idea of `AppImageFile.isValid()` method.
We do not support backward compatibility for .jpackage.xml for simplicity.
We do support only the case when an application image supplied in `--app-image` parameter to jpackage was created by the same jpackage, and not by jpackage from another JDK or from the same JDK but on another platform.

I'd discard this fix and create a new one that will:
1. Make `AppImageFile.getVersion()` return the value of `java.version` system property instead of hardcoded "1.0" value.
2. If `AppImageFile.isValid()` returns false, throw exception saying that .jpackage.xml is malformed instead of returning empty AppImageFile instance from `AppImageFile.load()`.

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

PR: https://git.openjdk.java.net/jdk/pull/9098


More information about the core-libs-dev mailing list