RFR: 8377331: jpackage: improve sign errors reporting

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


On Thu, 5 Feb 2026 23:23:28 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

> 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.

@sashamatveev PTAL

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

PR Comment: https://git.openjdk.org/jdk/pull/29596#issuecomment-3857217861


More information about the core-libs-dev mailing list