You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Lorenz Quack (JIRA)" <ji...@apache.org> on 2017/08/23 15:32:00 UTC
[jira] [Created] (QPID-7897) [Java 0-8...0-9-1 Client]
Message#getJMSCorrelationIDAsBytes() erroneously first converts to string
before retreiving bytes
Lorenz Quack created QPID-7897:
----------------------------------
Summary: [Java 0-8...0-9-1 Client] Message#getJMSCorrelationIDAsBytes() erroneously first converts to string before retreiving bytes
Key: QPID-7897
URL: https://issues.apache.org/jira/browse/QPID-7897
Project: Qpid
Issue Type: Bug
Components: Java Client
Reporter: Lorenz Quack
If the correlationId of a message does not contain valid UTF_8 (e.g., set via {{javax.jms.Message#setJMSCorrelationIDAsBytes}}) then {{javax.jms.Message#getJMSCorrelationIDAsBytes}} does not return the correct value.
Some relevant code snippets:{{AMQMessageDelegate_0_8#getJMSCorrelationIDAsBytes}} is implemented as follows:
{code:title=AMQMessageDelegate_0_8.java}public byte[] getJMSCorrelationIDAsBytes() throws JMSException
{
return getContentHeaderProperties().getCorrelationIdAsString().getBytes();
}{code}
{code:title=BasicContentHeaderProperties}public String getCorrelationIdAsString()
{
return (_correlationId == null) ? null : _correlationId.toString();
}{code}
{code:title=AMQShortString}public String toString()
{
if (_asString == null)
{
_asString = new String(_data, _offset, _length, StandardCharsets.UTF_8);
}
return _asString;
}{code}
If {{_data}} does not contain valid UTF_8 the result of this call chain is incorrect.
I do not see a reason why {{AMQMessageDelegate_0_8#getJMSCorrelationIDAsBytes}} should not return {{getContentHeaderProperties().getCorrelationId().getBytes()}} instead.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org