summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-05-21 12:42:33 +0000
committerGordon Sim <gsim@apache.org>2009-05-21 12:42:33 +0000
commit12ed230c0d4e3bf427b1ff058884ab6dd994a1b4 (patch)
tree74b2930f1627f8512f42618b5327a0a3230fa515 /cpp/src
parent8ac585d1a4cf8facf8eb1109f8e028ccde1b31f4 (diff)
downloadqpid-python-12ed230c0d4e3bf427b1ff058884ab6dd994a1b4.tar.gz
Handle case where recovered exchange is of unrecognised type.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@777096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/Exchange.cpp11
-rw-r--r--cpp/src/qpid/broker/RecoveryManagerImpl.cpp7
2 files changed, 14 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/Exchange.cpp b/cpp/src/qpid/broker/Exchange.cpp
index acedd1f91a..6ce381d199 100644
--- a/cpp/src/qpid/broker/Exchange.cpp
+++ b/cpp/src/qpid/broker/Exchange.cpp
@@ -160,9 +160,14 @@ Exchange::shared_ptr Exchange::decode(ExchangeRegistry& exchanges, Buffer& buffe
buffer.getShortString(type);
buffer.get(args);
- Exchange::shared_ptr exch = exchanges.declare(name, type, durable, args).first;
- exch->sequenceNo = args.getAsInt64(qpidSequenceCounter);
- return exch;
+ try {
+ Exchange::shared_ptr exch = exchanges.declare(name, type, durable, args).first;
+ exch->sequenceNo = args.getAsInt64(qpidSequenceCounter);
+ return exch;
+ } catch (const UnknownExchangeTypeException&) {
+ QPID_LOG(warning, "Could not create exchange " << name << "; type " << type << " is not recognised");
+ return Exchange::shared_ptr();
+ }
}
void Exchange::encode(Buffer& buffer) const
diff --git a/cpp/src/qpid/broker/RecoveryManagerImpl.cpp b/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
index fa891f84bf..1e8dcd9868 100644
--- a/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
+++ b/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
@@ -103,7 +103,12 @@ public:
RecoverableExchange::shared_ptr RecoveryManagerImpl::recoverExchange(framing::Buffer& buffer)
{
- return RecoverableExchange::shared_ptr(new RecoverableExchangeImpl(Exchange::decode(exchanges, buffer), queues));
+ Exchange::shared_ptr e = Exchange::decode(exchanges, buffer);
+ if (e) {
+ return RecoverableExchange::shared_ptr(new RecoverableExchangeImpl(e, queues));
+ } else {
+ return RecoverableExchange::shared_ptr();
+ }
}
RecoverableQueue::shared_ptr RecoveryManagerImpl::recoverQueue(framing::Buffer& buffer)