Qpid
  1. Qpid
  2. QPID-3011

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.9
    • Component/s: Java Client
    • Labels:
      None

      Description

      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

        Activity

        Hide
        Rajith Attapattu added a comment -

        Fixed along with a test case.

        Show
        Rajith Attapattu added a comment - Fixed along with a test case.

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development