On 06/12/2014 03:06 PM, Jan Bares wrote:
Hi,

property passed with message like that:

qpid-send -b ${BROKER} -a exchange/cal --durable yes --content-string "content" 
--property MyProp=MyValue

will throw MessageFormatException in getStringProperty() in Java JMS client. 
The class of value is array of bytes instead of String.

javax.jms.MessageFormatException: getString("WoodFileName") failed as value of 
type class [B is an array.
         at 
org.apache.qpid.client.message.AMQMessageDelegate_0_10.getStringProperty(AMQMessageDelegate_0_10.java:753)
         at 
org.apache.qpid.client.message.AbstractJMSMessage.getStringProperty(AbstractJMSMessage.java:225)
         at 
com.wood.engine.messages.InboundMessageEngine$MtiMessageListener.onMessage(InboundMessageEngine.java:900)
         at 
com.wood.util.jms.MessageListenerBatchAck.runImpl(MessageListenerBatchAck.java:112)
         at 
com.wood.util.jms.MessageListenerBatchAck.run(MessageListenerBatchAck.java:85)
         at java.lang.Thread.run(Thread.java:745)

qpid-send as of QPID 0.18, C++ broker 0.18, Java JMS client 0.18. It seems the 
problem is in qpid-send because message properties passed from .NET are read as 
Strings in Java.

That's an issue with qpid-send, which doesn't set the string properties to be utf8 encoded, meaning they get transferred as binary which is then converted to a byte[] in Java.

I'll check in a fix for that shortly (https://issues.apache.org/jira/browse/QPID-5814).

Note you can avoid the issue by explicitly setting the encoding of the property sent in c++ to "utf8" in the application. (See for example the fix to drain that was committed already: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/messaging/spout.cpp?r1=1513536&r2=1516917&pathrev=1601779)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to