You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jan Bares <ja...@wood.cz> on 2014/06/12 16:06:34 UTC

qpid-send and --properties possible bug/compatibility problem?

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.

Kind regards, Jan




DISCLAIMER
________________________________
         WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Slovakia by the NBS and in the UK by the FCA as Host State regulators. For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.com<http://www.wood.com/> under section Corporate Governance.
         Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment research opinions.
         This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).
________________________________

Re: qpid-send and --properties possible bug/compatibility problem?

Posted by Gordon Sim <gs...@redhat.com>.
On 06/13/2014 02:46 PM, Andrew Stitcher wrote:
> On Fri, 2014-06-13 at 12:25 +0000, Jan Bares wrote:
>> Thank you Gordon, I explicitly set the encoding on property variant in qpid-send.cpp and it worked for me too.
>
> Do you think this might be handled better in the JMS client too. I don't
> think  that JMS specifies what to do in this case so just coercing the
> byte array to a string might also make sense?

I think the JMS client is behaving reasonably, in that a value 
explicitly identified as 'binary' is best represented in java as a byte[].


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: qpid-send and --properties possible bug/compatibility problem?

Posted by Andrew Stitcher <as...@redhat.com>.
On Fri, 2014-06-13 at 12:25 +0000, Jan Bares wrote:
> Thank you Gordon, I explicitly set the encoding on property variant in qpid-send.cpp and it worked for me too.

Do you think this might be handled better in the JMS client too. I don't
think  that JMS specifies what to do in this case so just coercing the
byte array to a string might also make sense?

Andrew



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: qpid-send and --properties possible bug/compatibility problem?

Posted by Jan Bares <ja...@wood.cz>.
Thank you Gordon, I explicitly set the encoding on property variant in qpid-send.cpp and it worked for me too.

Kind regards, Jan

> -----Original Message-----
> From: Gordon Sim [mailto:gsim@redhat.com]
> Sent: Friday, June 13, 2014 1:54 PM
> To: users@qpid.apache.org
> Subject: Re: qpid-send and --properties possible bug/compatibility problem?
>
> On 06/13/2014 11:13 AM, Gordon Sim wrote:
> > I'll check in a fix for that shortly
> > (https://issues.apache.org/jira/browse/QPID-5814).
>
> Done: http://svn.apache.org/r1602390
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org




DISCLAIMER
________________________________
         WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Slovakia by the NBS and in the UK by the FCA as Host State regulators. For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.com<http://www.wood.com/> under section Corporate Governance.
         Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment research opinions.
         This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).
________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: qpid-send and --properties possible bug/compatibility problem?

Posted by Gordon Sim <gs...@redhat.com>.
On 06/13/2014 11:13 AM, Gordon Sim wrote:
> I'll check in a fix for that shortly
> (https://issues.apache.org/jira/browse/QPID-5814).

Done: http://svn.apache.org/r1602390


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: qpid-send and --properties possible bug/compatibility problem?

Posted by Gordon Sim <gs...@redhat.com>.
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: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org