You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/03/10 23:54:44 UTC
[jira] [Commented] (QPID-7134) [C++ client] Message::setContent("")
does not work
[ https://issues.apache.org/jira/browse/QPID-7134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15190123#comment-15190123 ]
ASF subversion and git services commented on QPID-7134:
-------------------------------------------------------
Commit 1734476 from [~gsim] in branch 'qpid/trunk'
[ https://svn.apache.org/r1734476 ]
QPID-7134: ensure content object is reset when bytes are set
> [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
>
> 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