RFR: 8253149: Building an installer from invalid app image fails on Window…

Alexey Semenyuk asemenyuk at openjdk.java.net
Mon Sep 21 13:52:32 UTC 2020


On Sun, 20 Sep 2020 21:23:17 GMT, Andy Herrick <herrick at openjdk.org> wrote:

> 8253149: Building an installer from invalid app image fails on Windows and Linux
> When jpackage builds a package from an app-image that was not generated by jpackage, the tool should give user a
> warning message, and then complete the package anyway.

test/jdk/tools/jpackage/share/AppImagePackageTest.java line 73:

> 71:         final String name = "EmptyAppImagePackageTest";
> 72:         final String imageName = name + (TKit.isOSX() ? ".app" : "");
> 73:         Path appImageDir = TKit.workDir().resolve(imageName);

I'd suggest to use Tkit.createTempDirectory() to create temp directory. The function will create unique directory every
time it is called allowing to run the test multiple times and have fresh empty directory in every run.

test/jdk/tools/jpackage/share/AppImagePackageTest.java line 81:

> 79:             Path readme = Files.createFile(libdir.resolve("README"));
> 80:             try (BufferedWriter bw = Files.newBufferedWriter(readme)) {
> 81:                 bw.write("This is some arbitrary ext for the README file\n");

All these lines can be replaced with a single call

`TKit.createTextFile(List.of("This is some arbitrary text for the README file"));`

This statement will add log statements, so no manual logging is required. Also there is no need for try/catch block

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java line 275:

> 273:                     actualCriticalRuntimePaths);
> 274:         } else {
> 275:             // AppImagePackageTest.testEmpty() will no dependencied,

Looks like a typo

src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/resources/MainResources.properties line 77:

> 75:
> 76: warning.no.jdk.modules.found=Warning: No JDK Modules found
> 77: warning.forign-app-image=Warning: app-image dir ({0}) not generated by jpackage.

Should the id be named "foreign" instead of "forign"?

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

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


More information about the core-libs-dev mailing list