From 4d492bea0ee5fb00dcceca9366375cb87d32fe94 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Mon, 21 May 2018 09:55:15 -0500 Subject: [PATCH] ARTEMIS-1874 fix NPE setting object property --- .../apache/activemq/artemis/jms/client/ActiveMQMessage.java | 2 +- .../artemis/tests/integration/jms/client/MessageTest.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index 6e28c0e460..18f8000582 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -965,7 +965,7 @@ public class ActiveMQMessage implements javax.jms.Message { boolean result = false; if (jmsPropertyName.equals(name)) { - message.putStringProperty(corePropertyName, value.toString()); + message.putStringProperty(corePropertyName, value == null ? null : value.toString()); result = true; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java index 29063f201d..5641bbf4fc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java @@ -26,6 +26,7 @@ import javax.jms.Session; import javax.jms.StreamMessage; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; +import org.apache.activemq.artemis.reader.MessageUtil; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.junit.Assert; @@ -193,6 +194,10 @@ public class MessageTest extends JMSTestBase { msg.setObjectProperty(MessageTest.propName1, null); + msg.setObjectProperty(MessageUtil.JMSXGROUPID, null); + + msg.setObjectProperty(MessageUtil.JMSXUSERID, null); + msg.setStringProperty(MessageTest.propName2, null); msg.getStringProperty(MessageTest.propName1);