Skip to content

MessagingException should not provide empty description String to NestedRuntimeException [SPR-13447] #18027

@spring-projects-issues

Description

@spring-projects-issues

Artem Bilan opened SPR-13447 and commented

The code to consider:

public MessagingException(Message<?> message) {
	super("");
	this.failedMessage = message;
}

Where the NestedRuntimeException superclass does this:

public String getMessage() {
	return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}

And that utility method implementation is like this:

if (message != null) {
	sb.append(message).append("; ");
}

Having such a logic we end up with bad StackTrace message which is starting just from the "; " string.

We can just provide the null for that description to the superclass or deprecate all those constructors without description argument in the MessagingException and its inheritors to make end user to provide the particular info for better logs readability.

See the linked Spring Integration issue and its Pull Request for more info.

Looking forward for any other thoughts on the matter!

Thanks in advance


Affects: 4.1.7, 4.2.1

Issue Links:

Referenced from: commits c4f5a0f, 987d93f

Backported to: 4.1.8

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions