Qpid
  1. Qpid
  2. QPID-3108

QueueSender incorrectly checks for null queue

    Details

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

      Description

      JMS documents that you can create a QueueSender with a null queue (called an unidentified queue in the documentation) and this is fine as long as you don't try to use one fo the send methods that relies on the queue being set up at construction time.

      The current code checks for null queue in the getters too and so causes erroneous UnsupportedOperationException exceptions to be throw when they are used with an unidentified queue.

        Activity

        Hide
        Rajith Attapattu added a comment -

        What you need here is to extend your test class using QpidBrokerTestCase. The rest is taken care of for you.
        You don't need to worry about whether it's in-vm , java broker or C++ broker as the type of broker is determined by the respective test profile.

        Add your test in the systests module and have a look at the AddressBasedDestinationTest as an example.

        Had you asked on the mailing list, it could have saved you 2 hours

        Show
        Rajith Attapattu added a comment - What you need here is to extend your test class using QpidBrokerTestCase. The rest is taken care of for you. You don't need to worry about whether it's in-vm , java broker or C++ broker as the type of broker is determined by the respective test profile. Add your test in the systests module and have a look at the AddressBasedDestinationTest as an example. Had you asked on the mailing list, it could have saved you 2 hours
        Hide
        Andrew Stitcher added a comment -

        When working on this fix I wanted to create a failing unit test to avoid any regression. [Note this bug is similar to a 4 year old Jira QPID-231].

        I was puzzled that I could find virtually no unit tests at all for the JMS client code.

        So I started to add one.

        At first it seemed simple enough I'd create a connection object from a URL then create a QueueSession then a QueueSender.

        When I did this I realised that the Connection needs to actually talk to the broker when you create it (to figure out which delegate to create 0_10 or 0_8 etc.) and so Ihad to have a broker running.

        No problem I thought - the Java broker supports in memory brokers, it even has a coll URL syntax, how hard can it be?

        Two hours later I realised why there are no unit tests for even the simple stuff in JMS - creating an in memory broker requires a whole chain of obscure stuff to be there. I even found a couple of references on the mailing list and in stackoverflow to indicate I wasn't the first to try this. There was no indication that anyone else had succeeded though.

        Show
        Andrew Stitcher added a comment - When working on this fix I wanted to create a failing unit test to avoid any regression. [Note this bug is similar to a 4 year old Jira QPID-231] . I was puzzled that I could find virtually no unit tests at all for the JMS client code. So I started to add one. At first it seemed simple enough I'd create a connection object from a URL then create a QueueSession then a QueueSender. When I did this I realised that the Connection needs to actually talk to the broker when you create it (to figure out which delegate to create 0_10 or 0_8 etc.) and so Ihad to have a broker running. No problem I thought - the Java broker supports in memory brokers, it even has a coll URL syntax, how hard can it be? Two hours later I realised why there are no unit tests for even the simple stuff in JMS - creating an in memory broker requires a whole chain of obscure stuff to be there. I even found a couple of references on the mailing list and in stackoverflow to indicate I wasn't the first to try this. There was no indication that anyone else had succeeded though.

          People

          • Assignee:
            Andrew Stitcher
            Reporter:
            Andrew Stitcher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development