[JMS_SPEC-78] JMS implementation of QueueRequestor and TopicRequestor doesn't throw correct exception when destination is null Created: 16/Feb/12  Updated: 20/Mar/13  Resolved: 04/Sep/12

Status: Resolved
Project: jms-spec
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 2.0PD, 2.0

Type: Bug Priority: Major
Reporter: Nigel Deakin Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Dependency
blocks MQ-197 JMS TCK test queueRequestorExceptionT... Closed
Tags: pd20-added

 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.



 Comments   
Comment by Nigel Deakin [ 04/Sep/12 ]

Now fixed.

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

Generated at Sun Mar 29 21:44:24 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.