Skip to content

jarmode tools commands print stacktrace instead of an error message - #51540

Merged
mhalbritter merged 1 commit into
spring-projects:4.0.xfrom
xxxxxxjun:fix-tools-jarmode-error-message
Sep 2, 2026
Merged

mhalbritter merged 1 commit into
spring-projects:4.0.xfrom
xxxxxxjun:fix-tools-jarmode-error-message

Conversation

@xxxxxxjun

@xxxxxxjun xxxxxxjun commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Split out of #51505 at @mhalbritter's request.

The tools jar mode wraps every exception in IllegalStateException, so a JarModeErrorException thrown by a command never reaches the branch of JarModeRunner that prints Error: <message>. Running list-layers against a jar built without layers shows a stack trace instead of Error: Layers are not enabled.

JarMode declares run as throws JarModeErrorException "on an error that should print a simple error message", so the wrapping breaks that contract. It predates the exception: #43435 added JarModeErrorExceptionand convertedExtractCommandandLayers, but left ToolsJarMode` alone. Rethrowing ahead of the generic catch restores the branch.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 2, 2026
@xxxxxxjun
xxxxxxjun force-pushed the fix-tools-jarmode-error-message branch from db0210f to be7ca77 Compare September 2, 2026 09:44
@mhalbritter mhalbritter self-assigned this Sep 2, 2026
@mhalbritter mhalbritter changed the title Print a simple error message when a tools command fails jarmode tools commands print stacktrace instead of an error message Sep 2, 2026
@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 2, 2026
@mhalbritter
mhalbritter force-pushed the fix-tools-jarmode-error-message branch from be7ca77 to d92a75c Compare September 2, 2026 14:22
@mhalbritter mhalbritter added this to the 4.0.9 milestone Sep 2, 2026
@mhalbritter
mhalbritter merged commit 9385181 into spring-projects:4.0.x Sep 2, 2026
4 checks passed
@mhalbritter

Copy link
Copy Markdown
Contributor

Thanks @xxxxxxjun !

@xxxxxxjun
xxxxxxjun deleted the fix-tools-jarmode-error-message branch September 2, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants