You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/01/03 15:19:32 UTC

svn commit: r1555106 - in /qpid/trunk/qpid/cpp/src/qpid/broker/amqp: NodeProperties.cpp NodeProperties.h Session.cpp

Author: gsim
Date: Fri Jan  3 14:19:32 2014
New Revision: 1555106

URL: http://svn.apache.org/r1555106
Log:
QPID-5447: check whether exchange type was actually specified before raising error

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp?rev=1555106&r1=1555105&r2=1555106&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp Fri Jan  3 14:19:32 2014
@@ -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* dat
 
 }
 
-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::getExchangeT
 {
     return exchangeType;
 }
+std::string NodeProperties::getSpecifiedExchangeType() const
+{
+    return wasSpecified(EXCHANGE_TYPE) ? exchangeType : EMPTY;
+}
 std::string NodeProperties::getAlternateExchange() const
 {
     return alternateExchange;

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h?rev=1555106&r1=1555105&r2=1555106&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h Fri Jan  3 14:19:32 2014
@@ -65,6 +65,7 @@ class NodeProperties : public qpid::amqp
     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
     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
 

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1555106&r1=1555105&r2=1555106&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp Fri Jan  3 14:19:32 2014
@@ -234,7 +234,7 @@ Session::ResolvedNode Session::resolve(c
     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");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org