You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2016/12/02 12:47:01 UTC

activemq git commit: fix up createPublisher contract to throw on null topic param, match the java doc

Repository: activemq
Updated Branches:
  refs/heads/master 11d968df5 -> 29ecfd6cd


fix up createPublisher contract to throw on null topic param, match the java doc


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/29ecfd6c
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/29ecfd6c
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/29ecfd6c

Branch: refs/heads/master
Commit: 29ecfd6cdbad76617242ab91be5dd75a14a14425
Parents: 11d968d
Author: gtully <ga...@gmail.com>
Authored: Fri Dec 2 12:46:32 2016 +0000
Committer: gtully <ga...@gmail.com>
Committed: Fri Dec 2 12:46:32 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/activemq/ActiveMQSession.java  |  3 +++
 .../org/apache/activemq/JmsTopicRedeliverTest.java | 17 +++++++++++++++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/29ecfd6c/activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java
index 6603a2f..98484a5 100644
--- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java
+++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java
@@ -1701,6 +1701,9 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta
      */
     @Override
     public TopicPublisher createPublisher(Topic topic) throws JMSException {
+        if (topic == null) {
+            throw new InvalidDestinationException("topic is null");
+        }
         checkClosed();
 
         if (topic instanceof CustomDestination) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/29ecfd6c/activemq-unit-tests/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java
index 188e4cd..c80242c 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java
@@ -17,14 +17,17 @@
 package org.apache.activemq;
 
 import javax.jms.Connection;
+import javax.jms.TopicConnection;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
+import javax.jms.TopicSession;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
+import javax.jms.TopicRequestor;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -150,6 +153,20 @@ public class JmsTopicRedeliverTest extends TestSupport {
         assertNull(consumer.receiveNoWait());
     }
 
+    public void testExOnNullDestToTopicRequestor() throws Exception {
+
+        TopicConnection topicConnection = connectionFactory.createTopicConnection();
+        TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+        try {
+            TopicRequestor topicRequestor = new TopicRequestor(topicSession, null);
+            fail("Expect ex on invalid dest");
+        } catch (javax.jms.InvalidDestinationException expected) {
+        } finally {
+            topicConnection.close();
+        }
+    }
+
+
     protected MessageConsumer createConsumer() throws JMSException {
         if (durable) {
             LOG.info("Creating durable consumer");