ARTEMIS-2997 NPE with JMS queue/topic toString()
This commit is contained in:
parent
05b9c3cb6d
commit
2c0b192e81
|
@ -464,7 +464,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se
|
||||||
// Public --------------------------------------------------------
|
// Public --------------------------------------------------------
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return simpleAddress.toString();
|
return simpleAddress != null ? simpleAddress.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleString getSimpleAddress() {
|
public SimpleString getSimpleAddress() {
|
||||||
|
|
|
@ -21,6 +21,8 @@ import javax.jms.Queue;
|
||||||
import javax.jms.Topic;
|
import javax.jms.Topic;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
|
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
|
||||||
|
import org.apache.activemq.artemis.jms.client.ActiveMQQueue;
|
||||||
|
import org.apache.activemq.artemis.jms.client.ActiveMQTopic;
|
||||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||||
import org.apache.activemq.artemis.utils.RandomUtil;
|
import org.apache.activemq.artemis.utils.RandomUtil;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -81,6 +83,26 @@ public class ActiveMQDestinationTest extends ActiveMQTestBase {
|
||||||
Assert.assertTrue(destination instanceof Destination);
|
Assert.assertTrue(destination instanceof Destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueueToStringNPE() {
|
||||||
|
ActiveMQDestination destination = new ActiveMQQueue();
|
||||||
|
try {
|
||||||
|
System.out.println("Destination: " + destination.toString());
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
Assert.fail("Caught NPE!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTopicToStringNPE() {
|
||||||
|
ActiveMQDestination destination = new ActiveMQTopic();
|
||||||
|
try {
|
||||||
|
System.out.println("Destination: " + destination.toString());
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
Assert.fail("Caught NPE!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Package protected ---------------------------------------------
|
// Package protected ---------------------------------------------
|
||||||
|
|
||||||
// Protected -----------------------------------------------------
|
// Protected -----------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue