ARTEMIS-1874 fix NPE setting object property

(cherry picked from commit 4d492bea0e)
This commit is contained in:
Justin Bertram 2018-05-21 09:55:15 -05:00 committed by Romain Pelisse
parent c3fded0be8
commit 11ce7f864e
2 changed files with 6 additions and 2 deletions

View File

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

View File

@ -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);