RFR: 8351073: [macos] jpackage produces invalid Java runtime DMG bundles [v4]
Alexander Matveev
almatvee at openjdk.org
Wed Jul 16 02:01:57 UTC 2025
On Mon, 14 Jul 2025 23:25:58 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> Alexander Matveev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8351073: [macos] jpackage produces invalid Java runtime DMG bundles [v3]
>
> src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromParams.java line 221:
>
>> 219: return IOUtils.exists(path1)
>> 220: && path1.toFile().list() != null
>> 221: && path1.toFile().list().length > 0
>
> This will result in reading the directory contents twice.
> Do this instead:
>
> Optional.ofNullable(path1.toFile().list()).map(list -> list.length > 0).orElse(false)
Fixed.
> src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromParams.java line 223:
>
>> 221: && path1.toFile().list().length > 0
>> 222: && IOUtils.exists(path2)
>> 223: && IOUtils.exists(path3);
>
> Please don't use `IOUtils.exists()` and other redundant wrappers over the `Files` class in the new code. Use `Files.exists()` instead.
Fixed.
> src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromParams.java line 238:
>
>> 236: return false;
>> 237: } catch (IOException ex) {
>> 238: throw new RuntimeException(ex);
>
> Should be either
>
> ExceptionBox.rethrowUnchecked(ex);
>
>
> or
>
> throw new UncheckedIOException(ex);
Fixed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26173#discussion_r2208832222
PR Review Comment: https://git.openjdk.org/jdk/pull/26173#discussion_r2208832346
PR Review Comment: https://git.openjdk.org/jdk/pull/26173#discussion_r2208860884
More information about the core-libs-dev
mailing list