NPE thrown when using a custom exchange in a replyTo address.
-------------------------------------------------------------

                 Key: QPID-3011
                 URL: https://issues.apache.org/jira/browse/QPID-3011
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: 0.8
            Reporter: Rajith Attapattu
            Assignee: Rajith Attapattu
            Priority: Minor
             Fix For: 0.9


The NPE is due to the generateDestination method in 
AbstractAMQMessageDelegate.java not handling the case where the _exchangeMap 
does not contain information about a particular exchange.

This _exchangeMap is pre populated with the known exchange types and any other 
exchange it discovers subsequently through the updateExchangeMethod.
However if it encounters an exchange which is not represented in the map, that 
case is not handled.

For example the following address is likely to cause an NPE if it is used as a 
replyTo address and wasn't used previously by any of the producers or consumers 
for that particular session.
"hello;{create:always,node:{type:topic}}"

The solution to this problem should be two fold IMO

1. Handle the null case - if information regarding an exchange is not present, 
create an ExchangeInfo object using the exchange-name, "" as the exchange class 
and UNKOWN as the destination type and use that to create the destination.
   If this destination is then used in a consumer or a producer, the address 
resolution code will query the broker and figure out the correct information.
   However it would have been better if information could be queried an updated 
right within the the generateDestination method - but at present that does not 
seem to be easy to deal with.

2. Query and update the exchange information for the replyTo address (if 
present) just as we would for the "exchange" where the message originated from.
    This is done within the updateExchangeTypeMapping method in 
AMQMessageDelegate_0_10.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to