ARTEMIS-1874 fix NPE setting object property

This commit is contained in:
Justin Bertram 2018-05-21 09:55:15 -05:00 committed by Clebert Suconic
parent 6e6a76deab
commit 4d492bea0e
2 changed files with 6 additions and 1 deletions

View File

@ -965,7 +965,7 @@ public class ActiveMQMessage implements javax.jms.Message {
boolean result = false; boolean result = false;
if (jmsPropertyName.equals(name)) { if (jmsPropertyName.equals(name)) {
message.putStringProperty(corePropertyName, value.toString()); message.putStringProperty(corePropertyName, value == null ? null : value.toString());
result = true; result = true;
} }

View File

@ -26,6 +26,7 @@ import javax.jms.Session;
import javax.jms.StreamMessage; import javax.jms.StreamMessage;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; 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.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Assert; import org.junit.Assert;
@ -193,6 +194,10 @@ public class MessageTest extends JMSTestBase {
msg.setObjectProperty(MessageTest.propName1, null); msg.setObjectProperty(MessageTest.propName1, null);
msg.setObjectProperty(MessageUtil.JMSXGROUPID, null);
msg.setObjectProperty(MessageUtil.JMSXUSERID, null);
msg.setStringProperty(MessageTest.propName2, null); msg.setStringProperty(MessageTest.propName2, null);
msg.getStringProperty(MessageTest.propName1); msg.getStringProperty(MessageTest.propName1);