8267056: tools/jpackage/share/RuntimePackageTest.java fails with NoSuchFileException

Reviewed-by: asemenyuk, herrick
This commit is contained in:
Alexander Matveev 2021-05-21 00:44:39 +00:00
parent e094f3f856
commit 9eaa4afc99
2 changed files with 15 additions and 10 deletions

View File

@ -390,8 +390,11 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
Path rootDir = appLocation.getParent() == null ?
Path.of(".") : appLocation.getParent();
Path[] list = Files.list(rootDir).toArray(Path[]::new);
if (list != null) { // Should not happend
// Not needed for runtime installer and it might break runtime installer
// if parent does not have any other files
if (!StandardBundlerParam.isRuntimeInstaller(params)) {
try (var fileList = Files.list(rootDir)) {
Path[] list = fileList.toArray(Path[]::new);
// We should only have app image and/or .DS_Store
if (list.length == 1) {
return rootDir.toString();
@ -403,6 +406,7 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
}
}
}
}
// Copy to new root
Path newRoot = Files.createTempDirectory(

View File

@ -151,6 +151,7 @@ public class RuntimePackageTest {
final Path prefsDir = Path.of(".systemPrefs");
return files.map(root::relativize)
.filter(x -> !x.startsWith(prefsDir))
.filter(x -> !x.endsWith(".DS_Store"))
.collect(Collectors.toSet());
}
}