[ https://issues.apache.org/jira/browse/QPID-5961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086284#comment-14086284 ]
Chuck Rolke commented on QPID-5961: ----------------------------------- I contend that for a given message having getContent and getContentObject return two entirely different results is a bug. If fixing it is not worth the effort how enforcing the mutual exclusion on the sending side with a throw? Any sort of error would help a qpid user whereas silently returning bad data does not. > 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: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org