[
https://issues.apache.org/jira/browse/ARTEMIS-4106?focusedWorklogId=831828&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-831828
]
ASF GitHub Bot logged work on ARTEMIS-4106:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 07/Dec/22 18:04
Start Date: 07/Dec/22 18:04
Worklog Time Spent: 10m
Work Description: jbertram commented on code in PR #4302:
URL: https://github.com/apache/activemq-artemis/pull/4302#discussion_r1042524382
##########
artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverterTest.java:
##########
@@ -248,6 +248,7 @@ public void testBadPropertyConversion() throws Exception {
coreMessage.putStringProperty(hdrBrokerInTime, "5678");
coreMessage.putStringProperty(hdrCommandId, "foo");
coreMessage.putStringProperty(hdrDroppable, "true");
+ coreMessage.putStringProperty("", "");
Review Comment:
If a consumer using the core JMS client gets a message with an empty
property name it can retrieve the value using `getStringProperty("")`. The
empty name is also enumerated when using `javax.jms.Message#getPropertyNames`.
However, if you attempt to set a property with an empty name it will fail with
the expected `IllegalStateException`.
In short, supporting an empty property name in core seems a little weird,
but I don't see any spec violations here. Converting the core message
implementation to another implementation definitely could hit an
`IllegalStateException`, but that's not what this change is about.
Issue Time Tracking
-------------------
Worklog Id: (was: 831828)
Time Spent: 1h 40m (was: 1.5h)
> Do not set property with empty key name when converting to OpenWire
> -------------------------------------------------------------------
>
> Key: ARTEMIS-4106
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4106
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> If a property with an empty key name is set on a core message and then
> converted to OpenWire this exception is thrown in accordance with the [JMS
> spec|https://docs.oracle.com/javaee/7/api/javax/jms/Message.html#setObjectProperty-java.lang.String-java.lang.Object-]:
> {noformat}
> java.lang.IllegalArgumentException: Property name cannot be empty or null
> at
> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:497)
> at
> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:488)
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter.setAMQMsgObjectProperties(OpenWireMessageConverter.java:945)
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter.toAMQMessage(OpenWireMessageConverter.java:677)
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter.createMessageDispatch(OpenWireMessageConverter.java:481)
> ...{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)