qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Wall (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (QPID-7898) [Java 0-8...0-9-1 Client] Calling getJMSReplyTo on a received message can lead to NullPointerException
Date Tue, 14 Nov 2017 17:12:01 GMT

     [ https://issues.apache.org/jira/browse/QPID-7898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Keith Wall updated QPID-7898:
-----------------------------
    Status: Reviewable  (was: In Progress)

> [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
>            Assignee: Keith Wall
>             Fix For: qpid-java-client-0-x-6.3.0
>
>
> 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 address must not exist in the org.apache.qpid.client.message.AMQMessageDelegate_0_8#_destinationCache
> 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-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message