diff options
| author | Gordon Sim <gsim@apache.org> | 2014-01-03 14:19:32 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2014-01-03 14:19:32 +0000 |
| commit | f752022b87b8def8595e66f2587a4c7e3c92744f (patch) | |
| tree | 216f64f10f53c6b44bb372f790ae94c370f1fa8f /qpid/cpp/src | |
| parent | b46bc8c57bacabb5a8c2658254b4a5a3fa5ef9b3 (diff) | |
| download | qpid-python-f752022b87b8def8595e66f2587a4c7e3c92744f.tar.gz | |
QPID-5447: check whether exchange type was actually specified before raising error
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1555106 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp | 7 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/NodeProperties.h | 3 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/amqp/Session.cpp | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp b/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp index 586ff6d439..2072eb35b9 100644 --- a/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp +++ b/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp @@ -54,6 +54,7 @@ const std::string EXCLUSIVE("exclusive"); const std::string AUTO_DELETE("auto-delete"); const std::string ALTERNATE_EXCHANGE("alternate-exchange"); const std::string EXCHANGE_TYPE("exchange-type"); +const std::string EMPTY; pn_bytes_t convert(const std::string& s) { @@ -113,7 +114,7 @@ void NodeProperties::read(pn_data_t* data) } -bool NodeProperties::wasSpecified(const std::string& key) +bool NodeProperties::wasSpecified(const std::string& key) const { return specified.find(key) != specified.end(); } @@ -362,6 +363,10 @@ std::string NodeProperties::getExchangeType() const { return exchangeType; } +std::string NodeProperties::getSpecifiedExchangeType() const +{ + return wasSpecified(EXCHANGE_TYPE) ? exchangeType : EMPTY; +} std::string NodeProperties::getAlternateExchange() const { return alternateExchange; diff --git a/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h b/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h index e1f0d3e792..414ca3f1e8 100644 --- a/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h +++ b/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h @@ -65,6 +65,7 @@ class NodeProperties : public qpid::amqp::MapReader bool isExclusive() const; bool isAutodelete() const; std::string getExchangeType() const; + std::string getSpecifiedExchangeType() const; std::string getAlternateExchange() const; bool trackControllingLink() const; const qpid::types::Variant::Map& getProperties() const; @@ -81,7 +82,7 @@ class NodeProperties : public qpid::amqp::MapReader std::set<std::string> specified; void process(const std::string&, const qpid::types::Variant&, const qpid::amqp::Descriptor*); - bool wasSpecified(const std::string& key); + bool wasSpecified(const std::string& key) const; }; }}} // namespace qpid::broker::amqp diff --git a/qpid/cpp/src/qpid/broker/amqp/Session.cpp b/qpid/cpp/src/qpid/broker/amqp/Session.cpp index ab677faac3..2c4c9a6183 100644 --- a/qpid/cpp/src/qpid/broker/amqp/Session.cpp +++ b/qpid/cpp/src/qpid/broker/amqp/Session.cpp @@ -234,7 +234,7 @@ Session::ResolvedNode Session::resolve(const std::string name, pn_terminus_t* te node.properties.read(pn_terminus_properties(terminus)); if (node.exchange && createOnDemand && isTopicRequested) { - if (!node.properties.getExchangeType().empty() && node.properties.getExchangeType() != node.exchange->getType()) { + if (!node.properties.getSpecifiedExchangeType().empty() && node.properties.getExchangeType() != node.exchange->getType()) { //emulate 0-10 exchange-declare behaviour throw Exception(qpid::amqp::error_conditions::PRECONDITION_FAILED, "Exchange of different type already exists"); } |
