qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gordon Sim (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (QPID-7134) [C++ client] Message::setContent("") does not work
Date Thu, 10 Mar 2016 22:54:44 GMT

     [ https://issues.apache.org/jira/browse/QPID-7134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gordon Sim resolved QPID-7134.
------------------------------
       Resolution: Fixed
    Fix Version/s: qpid-cpp-next

> [C++ client] Message::setContent("") does not work
> --------------------------------------------------
>
>                 Key: QPID-7134
>                 URL: https://issues.apache.org/jira/browse/QPID-7134
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Client
>    Affects Versions: qpid-cpp-0.34
>            Reporter: Pavel Moravec
>            Assignee: Gordon Sim
>             Fix For: qpid-cpp-next
>
>
> Message::setContent internally updates just "bytes" property of the Message object but
not the "content" object. That brings problems when trying to reset content to empty one -
original content is still stored in "content" object property and e.g. an attempt to send
this "empty" message sends the message with original content.
> Reproducer (outside a broker, feel free to add receiving initial message from the broker,
or sending the result to it back):
> {noformat}
> #include <iostream>
> #include <qpid/messaging/Message.h>
> using namespace std;
> using namespace qpid::messaging;
> int main(int argc, char* argv[])
> {
>     qpid::types::Variant content("some content");
>     Message m1(content);
>     cout << "Message 1: initial content set to \"" << m1.getContent() <<
"\", contentSize = " << m1.getContentSize() << endl;
>     m1.setContent("message 1");
>     cout << "Message 1: after content set to \"" << m1.getContent() <<
"\", contentSize = " << m1.getContentSize() << endl;
>     m1.setContent(std::string());
>     cout << "Message 1: after content set to an empty string, the content is still
\"" << m1.getContent() << "\" and contentSize = " << m1.getContentSize()
<< endl;
>     return 0;
> }
> {noformat}
> That returns:
> {noformat}
> Message 1: initial content set to "some content", contentSize = 12
> Message 1: after content set to "message 1", contentSize = 9
> Message 1: after content set to an empty string, the content is still "some content"
and contentSize = 12
> {noformat}
> See "some content" of size 12 returned after an attempt to empty the message content.
See it is the _original_ content before first setContent called.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message