Improve error handling when resolving message payloads [SPR-14394] #18967
Labels
in: messaging
Issues in messaging modules (jms, messaging)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
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
The text was updated successfully, but these errors were encountered: