Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Jun 23, 2016 · 3 comments
Closed

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 23, 2016

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

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 23, 2016

Juergen Hoeller commented

Good catch! I've generally revised that exception message, also mentioning the original payload class now.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 23, 2016

Thomas Hehl commented

Excellent! So this will be in the next snapshot build?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 23, 2016

Juergen Hoeller commented

Indeed, the upcoming 4.3.1.BUILD-SNAPSHOT will have it. I'll backport it to 4.2.7 tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants