[
https://issues.apache.org/jira/browse/ARTEMIS-4106?focusedWorklogId=832885&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-832885
]
ASF GitHub Bot logged work on ARTEMIS-4106:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 12/Dec/22 21:40
Start Date: 12/Dec/22 21:40
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #4302:
URL: https://github.com/apache/activemq-artemis/pull/4302#discussion_r1046416900
##########
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java:
##########
@@ -927,6 +932,10 @@ private static void setAMQMsgObjectProperties(final
ActiveMQMessage amqMsg,
final Set<SimpleString>
props) throws IOException {
for (SimpleString s : props) {
final String keyStr = s.toString();
+ if (keyStr.length() == 0) {
Review Comment:
shouldn't it check for keyStr.trim().isEmpty() instead?
If I add a property named " " it will still go through and be converted.
as a matter of fact the test could add such condition?
Issue Time Tracking
-------------------
Worklog Id: (was: 832885)
Time Spent: 2h (was: 1h 50m)
> 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: 2h
> 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)