Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
A call to Message#getJMSReplyTo() can lead to a NullPointerException.
java.lang.NullPointerException at org.apache.qpid.client.message.AMQMessageDelegate_0_8.getJMSReplyTo(AMQMessageDelegate_0_8.java:301) at org.apache.qpid.client.message.AbstractJMSMessage.getJMSReplyTo(AbstractJMSMessage.java:104)
The circumstances are
- a Message received over AMQP 0-8...0-9-1
- the replyTo set to a non-BURL address not containing a slash ("/")
- the address must not exist in the org.apache.qpid.client.message.AMQMessageDelegate_0_8#_destinationCache
The code throwing the NPE:
AMQMessageDelegate_0_8#getJMSReplyTo (slightly edited for clarity)
public Destination getJMSReplyTo() throws JMSException { String replyToEncoding = getContentHeaderProperties().getReplyToAsString(); Destination dest; try { BindingURL binding = new AMQBindingURL(replyToEncoding); // something else } catch (URISyntaxException e) { if (replyToEncoding.startsWith("/")) { // something } else if (replyToEncoding.contains("/")) { // something } else if (getAMQSession().isQueueBound(replyToEncoding, null, null)) { // THE ABOVE CALL TO getAMQSession THROWS A NPE!!! } else { // something } } return dest; }
The root cause seems to be that we are relying on the Message having knowledge of the session but we aren't setting the Session on the Message on all code paths.
I encountered this testing message conversion.