Lorenz Quack created QPID-7898: ---------------------------------- Summary: [Java 0-8...0-9-1 Client] Calling getJMSReplyTo on a received message can lead to NullPointerException Key: QPID-7898 URL: https://issues.apache.org/jira/browse/QPID-7898 Project: Qpid Issue Type: Bug Components: Java Client Reporter: Lorenz Quack
A call to {{Message#getJMSReplyTo()}} can lead to a {{NullPointerException}}. {noformat}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){noformat} 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 code throwing the NPE: {code:title=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; }{code} 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. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org