On 02/14/2012 03:06 PM, Gordon Sim wrote:
The declare sent has the passive flag set to true.

I would argue that in the spirit of that flag, it should be perfectly
valid not to specify the type since we are simply asserting that it
exists, not trying to create it if it does not. I couldn't find anything
one way or the other in the specification however. (Attached patch to
relax the check in the java broker along these lines for consideration).

Doh! Patch corrected, I am suitably mortified at my stupid mistake...

Once I tested against the right broker I discovered that I wasn't even fixing the correct codepath. The corrected patch makes the change to bothe 0-8/0-9 and 0-10, but obviously the 0-10 case is the relevant one in this case.
Index: broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
===================================================================
--- broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java	(revision 1234761)
+++ broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java	(working copy)
@@ -98,7 +98,7 @@
                     }
                 }
             }
-            else if (!exchange.getTypeShortString().equals(body.getType()))
+            else if (!exchange.getTypeShortString().equals(body.getType()) && !((body.getType() == null || body.getType().length() ==0) && body.getPassive()))
             {
 
                 throw new AMQConnectionException(AMQConstant.NOT_ALLOWED, "Attempt to redeclare exchange: " + body.getExchange() + " of type " + exchange.getTypeShortString() + " to " + body.getType() +".",body.getClazz(), body.getMethod(),body.getMajor(),body.getMinor(),null);
Index: broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java
===================================================================
--- broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java	(revision 1234761)
+++ broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java	(working copy)
@@ -465,7 +465,7 @@
             }
             else
             {
-                if(!exchange.getTypeShortString().toString().equals(method.getType()))
+                if(!exchange.getTypeShortString().toString().equals(method.getType()) && (method.getType() != null && method.getType().length() > 0))
                 {
                     exception(session, method, ExecutionErrorCode.NOT_ALLOWED, "Cannot redeclare with a different exchange type");
                 }

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to