RFR: 8377331: jpackage: improve sign errors reporting

Alexey Semenyuk asemenyuk at openjdk.org
Fri Feb 6 01:05:03 UTC 2026


Improve reporting of errors from failed external commands, and signing errors in particular. Use the same formatting for signing errors as for any other errors.

Instead of printing:

"codesign" failed with following output:
jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: replacing existing signature
jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: bundle format unrecognized, invalid, or unsuitable
In subcomponent: jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app/Contents/foo.1
jdk.jpackage.internal.util.function.ExceptionBox: jdk.jpackage.internal.Codesign$CodesignException
        at jdk.jpackage/jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked(ExceptionBox.java:51)
        <stack trace omitted>
Error: jdk.jpackage.internal.Codesign$CodesignException


jpackage will print:

Error: Unexpected exit code 1 from executing the command /usr/bin/codesign -s 'Developer ID Application: jpackage.openjdk.java.net' -vvvv --timestamp --options runtime --prefix Hello. --keychain jpackagerTest.keychain --entitlements config/AppContentWarningMacSignTest.entitlements --force MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app
Command output:
MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: replacing existing signature
MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: bundle format unrecognized, invalid, or unsuitable
In subcomponent: MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app/Contents/foo.1


As for reporting generic errors from failed external commands, jpackage will always print the command's output, regardless of whether it is running in verbose or quiet mode. Previously, it would print command output only in quiet mode, assuming that in verbose mode, the output would be printed immediately after command execution. However, jpackage runs some commands quietly in verbose mode; if one of them failed, the user didn't see its output. To address this problem, jpackage will print the output of the failed command in both quiet and verbose modes.

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

Commit messages:
 - MacSignTest: follow-up for the removal of the "error.tool.failed.with.output" message.
 - TKit: add convenience methods TextStreamVerifier and TextStreamVerifier.Group classes; add assertEndOfTextStream(); MacHelper: add convenience methods to SignKeyOption and SignKeyOptionWithKeychain; Add FailedCommandErrorVerifier
 - Better signing failure reporting: print failed command line, not only the name of the command and its output
 - Always print failed command output

Changes: https://git.openjdk.org/jdk/pull/29596/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29596&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377331
  Stats: 276 lines in 10 files changed: 203 ins; 33 del; 40 mod
  Patch: https://git.openjdk.org/jdk/pull/29596.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29596/head:pull/29596

PR: https://git.openjdk.org/jdk/pull/29596


More information about the core-libs-dev mailing list