RFR: 8377331: jpackage: improve sign errors reporting [v2]

Alexander Matveev almatvee at openjdk.org
Mon Feb 9 21:39:58 UTC 2026


On Sat, 7 Feb 2026 03:27:34 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.
>
> Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Replace "verify" with "validate" in the new code.

Looks good.

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

Marked as reviewed by almatvee (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29596#pullrequestreview-3765931710


More information about the core-libs-dev mailing list