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

          Nigel Deakin created issue -
          Nigel Deakin made changes -
          Field Original Value New Value
          Description The javadocs for the constructor methods QueueRequestor(session,queue) and TopicRequestor(session,topic) state that is 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.



           
          The javadocs for the constructor methods QueueRequestor(session,queue) and TopicRequestor(session,topic) state that is 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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          Nigel Deakin made changes -
          Description The javadocs for the constructor methods QueueRequestor(session,queue) and TopicRequestor(session,topic) state that is 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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          Nigel Deakin made changes -
          Affects Version/s 1.1 [ 14685 ]
          Nigel Deakin made changes -
          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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          Nigel Deakin made changes -
          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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          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:

          {noformat}
              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);
              }
          {noformat}

          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.
           
          Nigel Deakin made changes -
          Tags pd20-planned
          Nigel Deakin made changes -
          Tags pd20-planned
          Nigel Deakin made changes -
          Tags pd20-forreview
          Nigel Deakin made changes -
          Tags pd20-forreview
          Nigel Deakin made changes -
          Tags pd20-minor
          Nigel Deakin made changes -
          Tags pd20-minor
          Nigel Deakin made changes -
          Tags pd20-veryminor
          Nigel Deakin made changes -
          Link This issue blocks MQ-197 [ MQ-197 ]
          Nigel Deakin made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.0 [ 14692 ]
          Resolution Fixed [ 1 ]
          Nigel Deakin made changes -
          Tags pd20-veryminor
          Nigel Deakin made changes -
          Tags pd20-added
          Nigel Deakin made changes -
          Fix Version/s 2.0PD [ 16049 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: