qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1160607 - in /qpid/trunk/qpid: cpp/src/qpid/broker/Broker.cpp tests/src/py/qpid_tests/broker_0_10/exchange.py
Date Tue, 23 Aug 2011 10:32:26 GMT
Author: gsim
Date: Tue Aug 23 10:32:25 2011
New Revision: 1160607

URL: http://svn.apache.org/viewvc?rev=1160607&view=rev
Log:
QPID-3363, QPID-3443: Corrected exception used for 'default access' rule violations to match
that specified for 'exchange-name-required'

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
    qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/exchange.py

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1160607&r1=1160606&r2=1160607&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Aug 23 10:32:25 2011
@@ -889,6 +889,9 @@ void Broker::deleteExchange(const std::s
             throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied exchange delete
request from " << userId));
     }
 
+    if (name.empty()) {
+        throw framing::InvalidArgumentException(QPID_MSG("Delete not allowed for default
exchange"));
+    }
     Exchange::shared_ptr exchange(exchanges.get(name));
     if (!exchange) throw framing::NotFoundException(QPID_MSG("Delete failed. No such exchange:
" << name));
     if (exchange->inUseAsAlternate()) throw framing::NotAllowedException(QPID_MSG("Exchange
in use as alternate-exchange."));
@@ -917,7 +920,7 @@ void Broker::bind(const std::string& que
             throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied exchange bind
request from " << userId));
     }
     if (exchangeName.empty()) {
-        throw framing::NotAllowedException(QPID_MSG("Bind not allowed for default exchange"));
+        throw framing::InvalidArgumentException(QPID_MSG("Bind not allowed for default exchange"));
     }
 
     Queue::shared_ptr queue = queues.find(queueName);
@@ -950,7 +953,7 @@ void Broker::unbind(const std::string& q
             throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied exchange unbind
request from " << userId));
     }
     if (exchangeName.empty()) {
-        throw framing::NotAllowedException(QPID_MSG("Unbind not allowed for default exchange"));
+        throw framing::InvalidArgumentException(QPID_MSG("Unbind not allowed for default
exchange"));
     }
     Queue::shared_ptr queue = queues.find(queueName);
     Exchange::shared_ptr exchange = exchanges.get(exchangeName);

Modified: qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/exchange.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/exchange.py?rev=1160607&r1=1160606&r2=1160607&view=diff
==============================================================================
--- qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/exchange.py (original)
+++ qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/exchange.py Tue Aug 23 10:32:25 2011
@@ -463,24 +463,24 @@ class MiscellaneousErrorsTests(TestHelpe
         try:
             self.session.queue_declare(queue="my-queue", auto_delete=True, exclusive=True)
             self.session.exchange_bind(exchange="", queue="my-queue", binding_key="another-key")
-            self.fail("Expected 530 (not-allowed) code for bind to default exchange.")
+            self.fail("Expected 542 (invalid-argument) code for bind to default exchange.")
         except SessionException, e:
-            self.assertEquals(530, e.args[0].error_code)
+            self.assertEquals(542, e.args[0].error_code)
 
     def testDefaultAccessUnbind(self):
         try:
             self.session.queue_declare(queue="my-queue", auto_delete=True, exclusive=True)
             self.session.exchange_unbind(exchange="", queue="my-queue", binding_key="my-queue")
-            self.fail("Expected 530 (not-allowed) code for unbind from default exchange.")
+            self.fail("Expected 542 (invalid-argument) code for unbind from default exchange.")
         except SessionException, e:
-            self.assertEquals(530, e.args[0].error_code)
+            self.assertEquals(542, e.args[0].error_code)
 
     def testDefaultAccessDelete(self):
         try:
             self.session.exchange_delete(exchange="")
-            self.fail("Expected 530 (not-allowed) code for delete of default exchange.")
+            self.fail("Expected 542 (invalid-argument) code for delete of default exchange.")
         except SessionException, e:
-            self.assertEquals(530, e.args[0].error_code)
+            self.assertEquals(542, e.args[0].error_code)
 
 class ExchangeTests(TestHelper):
     def testHeadersBindNoMatchArg(self):



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message