Skip to content

MessageReceivingOperations returns 'null' if the payload cannot be converted [SPR-11817] #16437

@spring-projects-issues

Description

@spring-projects-issues

Stéphane Nicoll opened SPR-11817 and commented

MessageReceivingOperations.receiveAndConvert Javadoc states that the return value may be null

if the message could not be received, for example due to a timeout

However, both SimpleMessageConverter and GenericMessageConverter returns null if an existing payload cannot be converted. This looks like we're ignoring any conversion issue and I see two things we should review:

  1. The converter implementation simply returns null if the conversion is not supported or if the requested target type is not assignable to the payload
  2. In the receiver, it is impossible to make a difference between "no message" or "an existing message with a non convertible type"

Unless I am missing something, an exception should be thrown right the way if we can't convert it instead of returning null.


Affects: 3.2.9, 4.0.5

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions