Chuck Rolke created QPID-5961:
---------------------------------
Summary: C++ Messaging setContentObject(map) leaves broken message
Key: QPID-5961
URL: https://issues.apache.org/jira/browse/QPID-5961
Project: Qpid
Issue Type: Bug
Components: C++ Client
Affects Versions: 0.28
Environment: C++ trunk build
Reporter: Chuck Rolke
The Messaging function Message.setContentObject(someMap) fails to completely
set the message. After this call the message.getContent() returns a blank even
though the message holds a map.
Modifying the examples\messaging\map_sender.cpp to:
{noformat}
Message message;
Variant::Map content;
content["id"] = 987654321;
content["name"] = "Widget";
content["percent"] = 0.99;
Variant::List colours;
colours.push_back(Variant("red"));
colours.push_back(Variant("green"));
colours.push_back(Variant("white"));
content["colours"] = colours;
content["uuid"] = Uuid(true);
message.setContentObject(content);
std::cout << "Step 1. Where's the data?(fail)" << std::endl
<< "message.getContent(): " << std::endl
<< message.getContent() << std::endl;
Variant dataOut;
dataOut = message.getContentObject();
std::cout << "Step 2. Retrieve the map and print it (ok)." << std::endl
<< "dataOut.asString(): " << std::endl
<< dataOut.asString() << std::endl;
Message message2((Variant)content);
std::cout << "Step 3. Create a new message from original map (ok)" << std::endl
<< "message2.getContent(): " << std::endl
<< message2.getContent() << std::endl;
{noformat}
Produces this output:
{noformat}
Step 1. Where's the data?(fail)
message.getContent():
Step 2. Retrieve the map and print it (ok).
dataOut.asString():
{colours:[red, green, white], id:987654321, name:Widget, percent:0.9899999999999
9999, uuid:c4c602f9-d523-4711-8c4d-dad5330ddab4}
Step 3. Create a new message from original map (ok)
message2.getContent():
{colours:[red, green, white], id:987654321, name:Widget, percent:0.9899999999999
9999, uuid:c4c602f9-d523-4711-8c4d-dad5330ddab4}
{noformat}
The issue is that Step 1 produces no outupt. Step 2 retrieves the map from the
message and prints that OK. Step 3 constructs a new message from the map and
the prints normally.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]