summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/messaging
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-08-24 14:27:24 +0000
committerGordon Sim <gsim@apache.org>2011-08-24 14:27:24 +0000
commitc811fa4c2181f7dbb90a3d937852463cb351bdb0 (patch)
treedd935fa1a7be54db242d7b9c21cb9659796b6441 /cpp/src/qpid/messaging
parentf773ec7c99d1401b33761b11c9a421e0d44c9450 (diff)
downloadqpid-python-c811fa4c2181f7dbb90a3d937852463cb351bdb0.tar.gz
QPID-3445: Added some extra checks to decode logic; consolidated exception handling for message decode. Patch from Paul Colby.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1161119 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/messaging')
-rw-r--r--cpp/src/qpid/messaging/Message.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/qpid/messaging/Message.cpp b/cpp/src/qpid/messaging/Message.cpp
index 83cdfd3c55..ef70c103e9 100644
--- a/cpp/src/qpid/messaging/Message.cpp
+++ b/cpp/src/qpid/messaging/Message.cpp
@@ -21,6 +21,7 @@
#include "qpid/messaging/Message.h"
#include "qpid/messaging/MessageImpl.h"
#include "qpid/amqp_0_10/Codecs.h"
+#include <qpid/Exception.h>
#include <boost/format.hpp>
namespace qpid {
@@ -115,7 +116,11 @@ template <class C> struct MessageCodec
static void decode(const Message& message, typename C::ObjectType& object, const std::string& encoding)
{
checkEncoding(message, encoding);
- C::decode(message.getContent(), object);
+ try {
+ C::decode(message.getContent(), object);
+ } catch (const qpid::Exception &ex) {
+ throw EncodingException(ex.what());
+ }
}
static void encode(const typename C::ObjectType& map, Message& message, const std::string& encoding)