jms-spec
  1. jms-spec
  2. JMS_SPEC-78

JMS implementation of QueueRequestor and TopicRequestor doesn't throw correct exception when destination is null

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0PD, 2.0
    • Labels:
      None

      Description

      The javadocs for the constructor methods QueueRequestor(session,queue) and TopicRequestor(session,topic) state that a InvalidDestinationException should be thrown if an invalid queue/topic is specified.

      http://docs.oracle.com/javaee/6/api/javax/jms/QueueRequestor.html
      http://docs.oracle.com/javaee/6/api/javax/jms/TopicRequestor.html

      However if a value of null is supplied no exception is thrown, despite this not being valid.

      These classes are supplied with JMS rather than by implementations, which is why this is being logged here rather than with any particular JMS provider.

      If you look at the implementation:

          public
          QueueRequestor(QueueSession session, Queue queue) throws JMSException {
              this.session = session;
              this.queue   = queue;
              tempQueue    = session.createTemporaryQueue();
              sender       = session.createSender(queue);
              receiver     = session.createReceiver(tempQueue);
          }
      

      you can see why it doesn't throw an exception. Calling createQueue(null) is valid as it creates an anonymous producer. However although this is valid in general it isn't valid here. An explicit check for null needs to be added which should cause a InvalidDestinationException to be thrown.

        Issue Links

          Activity

          Hide
          Nigel Deakin added a comment -

          Now fixed.

          Note that the implementation of these classes is actually part of the RI.

          Show
          Nigel Deakin added a comment - Now fixed. Note that the implementation of these classes is actually part of the RI.

            People

            • Assignee:
              Unassigned
              Reporter:
              Nigel Deakin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: