[ 
https://issues.apache.org/jira/browse/AMQ-8398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17870274#comment-17870274
 ] 

Aleksei Zotov edited comment on AMQ-8398 at 8/1/24 7:23 PM:
------------------------------------------------------------

I experience the same problem with Python STOMP producer and TCP consumer.

Here is how to reproduce the problem:

+STOMP producer+
{code:java}
import stomp
c = stomp.Connection(host_and_ports=[('localhost', 61613)], 
auto_content_length=False)
c.connect(username='admin', passcode='admin', wait=True)
c.send(body="πŸ™ƒπŸ™‚", destination='test')
c.disconnect() {code}
+JMS consumer+
{code:java}
./bin/activemq consumer --destination queue://test --messageCount 1
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://test
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 1 messages are consumed
javax.jms.JMSException: java.io.UTFDataFormatException
  at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
  at 
org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:104)
  at 
org.apache.activemq.command.ActiveMQTextMessage.getText(ActiveMQTextMessage.java:84)
  at org.apache.activemq.util.ConsumerThread.run(ConsumerThread.java:64)
Caused by: java.io.UTFDataFormatException
  at 
org.apache.activemq.util.MarshallingSupport.convertUTF8WithBuf(MarshallingSupport.java:389)
  at 
org.apache.activemq.util.MarshallingSupport.readUTF8(MarshallingSupport.java:358)
  at 
org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:101)
  ... 2 more
INFO | consumer-1 Consumed: 0 messages
INFO | consumer-1 Consumer thread finished {code}
Β 

Whenever I use STOMP consumer, everything works as expected:
{code:java}
from stomp import *
c = Connection([('localhost', 61613)])
c.set_listener('', PrintingListener())
c.connect('admin', 'admin', wait=True)
c.subscribe('/queue/test', 123)
>>> on_message {'expires': '0', 'destination': '/queue/test', 'subscription': 
>>> '123', 'priority': '4', 'message-id': 
>>> 'ID:local-60233-1722449795714-3:11:-1:1:1', 'timestamp': '1722539590063'} 
>>> πŸ™ƒπŸ™‚ {code}
Environment details:
 * AMQ 5.16.3 (default configuration)
 * Python 3.9.19
 * stomp-py 8.1.2

Β 


was (Author: azotcsit):
I experience the same problem with Python STOMP producer and TCP consumer.

Here is how to reproduce the problem:

+STOMP producer+
{code:java}
import stomp
conn = stomp.Connection(host_and_ports=[('localhost', 61613)], 
auto_content_length=False)
conn.connect(username='admin', passcode='admin', wait=True)
conn.send(body="πŸ™ƒπŸ™‚", destination='test')
conn.disconnect() {code}
+JMS consumer+
{code:java}
./bin/activemq consumer --destination queue://test --messageCount 1
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://test
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 1 messages are consumed
javax.jms.JMSException: java.io.UTFDataFormatException
  at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
  at 
org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:104)
  at 
org.apache.activemq.command.ActiveMQTextMessage.getText(ActiveMQTextMessage.java:84)
  at org.apache.activemq.util.ConsumerThread.run(ConsumerThread.java:64)
Caused by: java.io.UTFDataFormatException
  at 
org.apache.activemq.util.MarshallingSupport.convertUTF8WithBuf(MarshallingSupport.java:389)
  at 
org.apache.activemq.util.MarshallingSupport.readUTF8(MarshallingSupport.java:358)
  at 
org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:101)
  ... 2 more
INFO | consumer-1 Consumed: 0 messages
INFO | consumer-1 Consumer thread finished {code}
Β 

Whenever I use STOMP consumer, everything works as expected:
{code:java}
from stomp import *
c = Connection([('localhost', 61613)])
c.set_listener('', PrintingListener())
c.connect('admin', 'admin', wait=True)
c.subscribe('/queue/test', 123)
>>> on_message {'expires': '0', 'destination': '/queue/test', 'subscription': 
>>> '123', 'priority': '4', 'message-id': 
>>> 'ID:local-60233-1722449795714-3:11:-1:1:1', 'timestamp': '1722539590063'} 
>>> πŸ™ƒπŸ™‚ {code}
Environment details:
 * AMQ 5.16.3 (default configuration)
 * Python 3.9.19
 * stomp-py 8.1.2

Β 

> 4-byte Unicode message from JMS to STOMP will be corrupted
> ----------------------------------------------------------
>
>                 Key: AMQ-8398
>                 URL: https://issues.apache.org/jira/browse/AMQ-8398
>             Project: ActiveMQ Classic
>          Issue Type: Bug
>          Components: Broker, STOMP, Transport
>    Affects Versions: 5.16.3
>            Reporter: Simon Lundstrom
>            Assignee: Jean-Baptiste OnofrΓ©
>            Priority: Major
>
> When sending a message from:
> JMS producer to STOMP consumer
> or
> STOMP producer to JMS consumer
> which contains a 4-byte unicode code points e.g. 
> https://unicode-table.com/en/1F5A4/ there is a corruption of the message.
> In the JMS to STOMP case the code point gets converted to:
> {{ef bf bd ef bf bd}} when it should be {{f0 9f 96 a4}}.
> and in the STOMP to JMS case the JMS client throws an exception:
> {code}
> Exception in thread "main" javax.jms.JMSException: 
> java.io.UTFDataFormatException
>         at 
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
>         at 
> org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:104)
>         at 
> org.apache.activemq.command.ActiveMQTextMessage.getText(ActiveMQTextMessage.java:84)
>         at testkonsument.App.JMS(App.java:86)
>         at testkonsument.App.main(App.java:42)
> Caused by: java.io.UTFDataFormatException
>         at 
> org.apache.activemq.util.MarshallingSupport.convertUTF8WithBuf(MarshallingSupport.java:389)
>         at 
> org.apache.activemq.util.MarshallingSupport.readUTF8(MarshallingSupport.java:358)
>         at 
> org.apache.activemq.command.ActiveMQTextMessage.decodeContent(ActiveMQTextMessage.java:101)
>         ... 3 more
> {code}
> Using 4-byte unicode points
> from STOMP to STOMP
> or
> from JMS to JMS
> is not a problem, both works and does not corrupt the code point.
> Note that 2- (e.g. https://unicode-table.com/en/00F6/) or 3-byte (e.g. 
> https://unicode-table.com/en/2614/) Unicode code points does NOT get 
> corrupted, even if the same message includes a 4-byte Unicode code point.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to