Skip to content

Improve error handling when resolving message payloads [SPR-14394] #18967

Closed
@spring-projects-issues

Description

@spring-projects-issues

Thomas Hehl opened SPR-14394 and commented

The error handling provides insufficient information to resolve the error when no converter is found. What follows is lines 117-120 of PayloadArgumentResolver.java.

{{ if (payload == null) {
throw new MessageConversionException(message,
"No converter found to convert to " + targetClass + ", message=" + message);
}}}

This does not provide information about the payload class that it's trying to convert. Error handling should be:

{{ if (payload == null) {
throw new MessageConversionException(message,
"No converter found to convert to " + targetClass + ", from " + payload.getClass() + ", message=" + message);
}}}


Affects: 4.2.5, 4.2.6

Reference URL: https://github.com/spring-projects/spring-framework/blob/4.2.x/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver.java

Referenced from: commits 07c9c55, f5282bc

Backported to: 4.2.7

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions