diff options
author | Gordon Sim <gsim@apache.org> | 2011-02-25 20:52:17 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2011-02-25 20:52:17 +0000 |
commit | 0bde4bed715b57c971b7be594f66953e731a2a00 (patch) | |
tree | 03ed5d62a620124c9f854694ac4eabd12b797fdb /cpp/src | |
parent | 57208a0fe53211efd075cf77baae79a36e7e71f0 (diff) | |
download | qpid-python-0bde4bed715b57c971b7be594f66953e731a2a00.tar.gz |
QPID-3087: fail rather than ignoring attempts to declare queues with bad arguments; ensure qpid-config can deal with different types of argument.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1074697 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/Broker.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/broker/QueuePolicy.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/broker/QueueRegistry.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/broker/QueueRegistry.h | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 695a926f74..4e7e78c961 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -790,15 +790,13 @@ std::pair<boost::shared_ptr<Queue>, bool> Broker::createQueue( if (!alternate) throw framing::NotFoundException(QPID_MSG("Alternate exchange does not exist: " << alternateExchange)); } - std::pair<Queue::shared_ptr, bool> result = queues.declare(name, durable, autodelete, owner); + std::pair<Queue::shared_ptr, bool> result = queues.declare(name, durable, autodelete, owner, arguments); if (result.second) { if (alternate) { result.first->setAlternateExchange(alternate); alternate->incAlternateUsers(); } - //apply settings & create persistent record if required - result.first->create(arguments); //add default binding: result.first->bind(exchanges.getDefault(), name); diff --git a/cpp/src/qpid/broker/QueuePolicy.cpp b/cpp/src/qpid/broker/QueuePolicy.cpp index 4168221ad0..b39ea3614b 100644 --- a/cpp/src/qpid/broker/QueuePolicy.cpp +++ b/cpp/src/qpid/broker/QueuePolicy.cpp @@ -136,11 +136,10 @@ uint32_t QueuePolicy::getCapacity(const FieldTable& settings, const std::string& string s(v->get<string>()); QPID_LOG(debug, "Got string value for " << key << ": " << s); std::istringstream convert(s); - if (convert >> result && result >= 0) return result; + if (convert >> result && result >= 0 && convert.eof()) return result; } - QPID_LOG(warning, "Cannot convert " << key << " to unsigned integer, using default (" << defaultValue << ")"); - return defaultValue; + throw IllegalArgumentException(QPID_MSG("Cannot convert " << key << " to unsigned integer: " << *v)); } std::string QueuePolicy::getType(const FieldTable& settings) diff --git a/cpp/src/qpid/broker/QueueRegistry.cpp b/cpp/src/qpid/broker/QueueRegistry.cpp index ea2531dae7..cdd1d87e63 100644 --- a/cpp/src/qpid/broker/QueueRegistry.cpp +++ b/cpp/src/qpid/broker/QueueRegistry.cpp @@ -36,7 +36,8 @@ QueueRegistry::~QueueRegistry(){} std::pair<Queue::shared_ptr, bool> QueueRegistry::declare(const string& declareName, bool durable, - bool autoDelete, const OwnershipToken* owner) + bool autoDelete, const OwnershipToken* owner, + const framing::FieldTable& arguments) { RWlock::ScopedWlock locker(lock); string name = declareName.empty() ? generateName() : declareName; @@ -45,6 +46,8 @@ QueueRegistry::declare(const string& declareName, bool durable, if (i == queues.end()) { Queue::shared_ptr queue(new Queue(name, autoDelete, durable ? store : 0, owner, parent, broker)); + //apply settings & create persistent record if required + queue->create(arguments); queues[name] = queue; if (lastNode) queue->setLastNodeFailure(); diff --git a/cpp/src/qpid/broker/QueueRegistry.h b/cpp/src/qpid/broker/QueueRegistry.h index 57859fe639..90ee924ba4 100644 --- a/cpp/src/qpid/broker/QueueRegistry.h +++ b/cpp/src/qpid/broker/QueueRegistry.h @@ -24,6 +24,7 @@ #include "qpid/broker/BrokerImportExport.h" #include "qpid/sys/Mutex.h" #include "qpid/management/Manageable.h" +#include "qpid/framing/FieldTable.h" #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> #include <algorithm> @@ -60,7 +61,8 @@ class QueueRegistry { const std::string& name, bool durable = false, bool autodelete = false, - const OwnershipToken* owner = 0); + const OwnershipToken* owner = 0, + const qpid::framing::FieldTable& args = framing::FieldTable()); /** * Destroy the named queue. |