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

2022-06-14 Thread Alexey Semenyuk
On Mon, 13 Jun 2022 17:01:48 GMT, Alexander Matveev  
wrote:

> - Error will be thrown if app image is generated with another JDK version or 
> has malformed .jpackage.xml.
>  - Re-fixed as Alexey suggested in https://github.com/openjdk/jdk/pull/9098.

src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties
 line 79:

> 77: warning.no.jdk.modules.found=Warnung: Keine JDK-Module gefunden
> 78: 
> 79: error.foreign-app-image=Error: app-image dir ({0}) not generated by 
> jpackage. Missing .jpackage.xml.

This error message will be misleading in case app image was generated by 
jpackage and adjusted after.
I'd put it as "Missing .jpackage.xml file in app-image dir ({0})."

-

PR: https://git.openjdk.org/jdk19/pull/9


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

2022-06-14 Thread Alexey Semenyuk
On Mon, 13 Jun 2022 17:01:48 GMT, Alexander Matveev  
wrote:

> - Error will be thrown if app image is generated with another JDK version or 
> has malformed .jpackage.xml.
>  - Re-fixed as Alexey suggested in https://github.com/openjdk/jdk/pull/9098.

src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java line 68:

> 66: private final List addLauncherInfos;
> 67: private final String signedStr;
> 68: private final String appStoreStr;

What is the idea of this change?

-

PR: https://git.openjdk.org/jdk19/pull/9


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

2022-06-08 Thread Alexey Semenyuk
On Thu, 9 Jun 2022 01:21:30 GMT, Alexander Matveev  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