When AbstractMessageSendingTemplate.convertAndSend is called with null headers and a payload that the converter cannot convert (i.e. converter.toMessage also returns null), the code attempts to throw a MessageConversionException but a NullPointerException occurs instead as the exception message attempts to get the content type from the null headers.
This bit of code was added with this commit, which I believe means AbstractMessagingTemplate.convertSendAndReceive is also affected. The fix is probably as easy as making the content type a separate variable where the headers can be null-checked, similar to how payloadType is declared.
Anders Schuller opened SPR-11653 and commented
When
AbstractMessageSendingTemplate.convertAndSend
is called with null headers and a payload that the converter cannot convert (i.e.converter.toMessage
also returns null), the code attempts to throw aMessageConversionException
but aNullPointerException
occurs instead as the exception message attempts to get the content type from the null headers.The relevant bit of code from AbstractMessageSendingTemplate:
This bit of code was added with this commit, which I believe means
AbstractMessagingTemplate.convertSendAndReceive
is also affected. The fix is probably as easy as making the content type a separate variable where the headers can be null-checked, similar to howpayloadType
is declared.Affects: 4.0.2, 4.0.3
Issue Links:
The text was updated successfully, but these errors were encountered: