If jpackage detects multiple errors on the command line, it will report them all, not just the first [1].
However, there is no support for passing multiple exceptions after command-line option validation. If multiple error conditions occur later in the execution flow, the first one is reported with the thrown exception, and the remaining are reported in place [2] instead of being handed to the top-level error reporter.
Use the standard suppressed exceptions mechanism to pass multiple exceptions to the top-level error reporter.
[1] https://github.com/openjdk/jdk/blob/f9ded7f88cce75151cec32d1ef1f9662ea10431a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java#L315
[2] https://github.com/openjdk/jdk/blob/f9ded7f88cce75151cec32d1ef1f9662ea10431a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java#L171
However, there is no support for passing multiple exceptions after command-line option validation. If multiple error conditions occur later in the execution flow, the first one is reported with the thrown exception, and the remaining are reported in place [2] instead of being handed to the top-level error reporter.
Use the standard suppressed exceptions mechanism to pass multiple exceptions to the top-level error reporter.
[1] https://github.com/openjdk/jdk/blob/f9ded7f88cce75151cec32d1ef1f9662ea10431a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java#L315
[2] https://github.com/openjdk/jdk/blob/f9ded7f88cce75151cec32d1ef1f9662ea10431a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java#L171
- links to
-
Review(master)
openjdk/jdk/29643