qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1747526 - /qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
Date Thu, 09 Jun 2016 10:15:54 GMT
Author: rgodfrey
Date: Thu Jun  9 10:15:53 2016
New Revision: 1747526

URL: http://svn.apache.org/viewvc?rev=1747526&view=rev
Log:
QPID-7298 : prevent exchange-declare-ok being sent when nowait=true

Modified:
    qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java

Modified: qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1747526&r1=1747525&r2=1747526&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
(original)
+++ qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
Thu Jun  9 10:15:53 2016
@@ -2938,10 +2938,10 @@ public class AMQChannel
             }
             else
             {
+                String name = exchangeName.toString();
+                String typeString = type == null ? null : type.toString();
                 try
                 {
-                    String name = exchangeName.toString();
-                    String typeString = type == null ? null : type.toString();
 
                     Map<String, Object> attributes = new HashMap<String, Object>();
                     if (arguments != null)
@@ -2968,23 +2968,23 @@ public class AMQChannel
                 }
                 catch (ReservedExchangeNameException e)
                 {
-                    Exchange existing = getExchange(exchangeName.toString());
-                    if (existing != null && new AMQShortString(existing.getType()).equals(type))
+                    Exchange existing = getExchange(name);
+                    if (existing == null || !existing.getType().equals(typeString))
                     {
-                        sync();
-                        _connection.writeFrame(declareOkBody.generateFrame(getChannelId()));
+                        _connection.sendConnectionClose(AMQConstant.NOT_ALLOWED,
+                                                        "Attempt to declare exchange: '"
+ exchangeName +
+                                                        "' which begins with reserved prefix.",
getChannelId());
                     }
-                    else
+                    else if(!nowait)
                     {
-                        _connection.sendConnectionClose(AMQConstant.NOT_ALLOWED,
-                                "Attempt to declare exchange: '" + exchangeName +
-                                        "' which begins with reserved prefix.", getChannelId());
+                        sync();
+                        _connection.writeFrame(declareOkBody.generateFrame(getChannelId()));
                     }
                 }
                 catch (ExchangeExistsException e)
                 {
                     exchange = e.getExistingExchange();
-                    if (!new AMQShortString(exchange.getType()).equals(type))
+                    if (!exchange.getType().equals(typeString))
                     {
                         _connection.sendConnectionClose(AMQConstant.NOT_ALLOWED, "Attempt
to redeclare exchange: '"
                                 + exchangeName + "' of type "



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


Mime
View raw message