Qpid
  1. Qpid
  2. QPID-2959

Java client null pointer exception thrown when there is no exchange set for ReplyTo

    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

      If the ReplyTo exchange is not set on a message read by the Java client, and
      getJMSReplyTo is called, the code does not properly handle the exchange being
      null.

      In the following code, replyTo.getExchange() returns null, so the String
      exchange is set to null, and thus the first argument to generateDestination
      ends up being null.

      AMQMessageDelegate_0_10.getJMSReplyTo() line: 224
      if (dest == null)
      {
      String exchange = replyTo.getExchange();
      String routingKey = replyTo.getRoutingKey();

      dest = generateDestination(exchange == null ? null : new
      AMQShortString(exchange),
      routingKey == null ? null : new
      AMQShortString(routingKey));

      In the following code, you can see that if the first argument (exchange) is
      null, you'll get a null pointer exception when the code attempts to call
      exchange.asString().

      protected AMQDestination generateDestination(AMQShortString exchange,
      AMQShortString routingKey)
      {
      AMQDestination dest;
      ExchangeInfo exchangeInfo = _exchangeMap.get(exchange.asString());

        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