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 2013/09/20 17:43:57 UTC

svn commit: r1525043 - in /qpid/trunk/qpid/cpp/src: qpid/broker/amqp/Translation.cpp tests/interlink_tests.py

Author: gsim
Date: Fri Sep 20 15:43:57 2013
New Revision: 1525043

URL: http://svn.apache.org/r1525043
Log:
QPID-5149: truncate over large routing keys when translating from 1.0 to 0-10

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Translation.cpp
    qpid/trunk/qpid/cpp/src/tests/interlink_tests.py

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Translation.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Translation.cpp?rev=1525043&r1=1525042&r2=1525043&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Translation.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Translation.cpp Fri Sep 20 15:43:57 2013
@@ -260,7 +260,12 @@ boost::intrusive_ptr<const qpid::broker:
             dp->setPriority(message->getPriority());
             if (message->isPersistent()) dp->setDeliveryMode(2);
             if (message->getRoutingKey().size()) {
-                dp->setRoutingKey(message->getRoutingKey());
+                if (message->getRoutingKey().size() > std::numeric_limits<uint8_t>::max()) {
+                    //have to truncate routing key as it is specified to be a str8
+                    dp->setRoutingKey(message->getRoutingKey().substr(0,std::numeric_limits<uint8_t>::max()));
+                } else {
+                    dp->setRoutingKey(message->getRoutingKey());
+                }
                 props->getApplicationHeaders().setString(SUBJECT_KEY, message->getRoutingKey());
             }
 

Modified: qpid/trunk/qpid/cpp/src/tests/interlink_tests.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/interlink_tests.py?rev=1525043&r1=1525042&r2=1525043&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/interlink_tests.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/interlink_tests.py Fri Sep 20 15:43:57 2013
@@ -128,6 +128,9 @@ class AmqpBrokerTest(BrokerTest):
     def test_translate2(self):
         self.send_and_receive(send_config=Config(self.broker, version="amqp0-10"))
 
+    def test_translate_with_large_routingkey(self):
+        self.send_and_receive(send_config=Config(self.broker, address="amq.topic/a.%s" % ("x" * 256), version="amqp1.0"), recv_config=Config(self.broker, address="amq.topic/a.*", version="amqp0-10"), wait_for_receiver=True)
+
     def send_and_receive_empty(self, send_config=None, recv_config=None):
         sconfig = send_config or self.default_config
         rconfig = recv_config or self.default_config



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