Throw an InvalidDestinationException early on if the topic is null for better JMS compliance.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1420820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-12-12 16:47:47 +00:00
parent 44a7ffa946
commit aaead5be21
1 changed files with 4 additions and 0 deletions

View File

@ -1292,6 +1292,10 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal) throws JMSException { public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal) throws JMSException {
checkClosed(); checkClosed();
if (topic == null) {
throw new InvalidDestinationException("Topic cannot be null");
}
if (isIndividualAcknowledge()) { if (isIndividualAcknowledge()) {
throw JMSExceptionSupport.create("Cannot create a durable consumer for a Session in "+ throw JMSExceptionSupport.create("Cannot create a durable consumer for a Session in "+
"INDIVIDUAL_ACKNOWLEDGE mode.", null); "INDIVIDUAL_ACKNOWLEDGE mode.", null);