qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject [1/6] qpid-broker-j git commit: QPID-8061: [Broker-J] [AMQP 0-8..0-9-1] Handle unknown alternate exchange on exchange declaration
Date Tue, 09 Jan 2018 15:39:58 GMT
Repository: qpid-broker-j
Updated Branches:
  refs/heads/7.0.x 4c8f854f1 -> 9a7628595


QPID-8061: [Broker-J] [AMQP 0-8..0-9-1] Handle unknown alternate exchange on exchange declaration

Cherry picked from master 38c04f8.


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/89259c2d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/89259c2d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/89259c2d

Branch: refs/heads/7.0.x
Commit: 89259c2de1aa1df1f582e0012c881cbb8cf61e00
Parents: 4c8f854
Author: Alex Rudyy <orudyy@apache.org>
Authored: Thu Dec 7 10:33:01 2017 +0000
Committer: Keith Wall <kwall@apache.org>
Committed: Tue Jan 9 14:50:54 2018 +0000

----------------------------------------------------------------------
 .../apache/qpid/server/exchange/AbstractExchange.java  |  5 +++--
 .../server/model/UnknownConfiguredObjectException.java | 13 +++++++++++--
 .../server/protocol/v0_10/ServerSessionDelegate.java   |  2 +-
 .../apache/qpid/server/protocol/v0_8/AMQChannel.java   |  9 ++-------
 4 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89259c2d/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
b/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
index 897878d..b3714e9 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
@@ -71,6 +71,7 @@ import org.apache.qpid.server.model.PublishingLink;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.StateTransition;
+import org.apache.qpid.server.model.UnknownConfiguredObjectException;
 import org.apache.qpid.server.protocol.LinkModel;
 import org.apache.qpid.server.queue.CreatingLinkInfo;
 import org.apache.qpid.server.security.SecurityToken;
@@ -1054,9 +1055,9 @@ public abstract class AbstractExchange<T extends AbstractExchange<T>>
                     _virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
             if (messageDestination == null)
             {
-                throw new IllegalConfigurationException(String.format(
+                throw new UnknownConfiguredObjectException(String.format(
                         "Cannot create alternate binding for '%s' : Alternate binding destination
'%s' cannot be found.",
-                        getName(), destinationName));
+                        getName(), destinationName), ConfiguredObject.class, destinationName);
             }
             else if (messageDestination == this)
             {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89259c2d/broker-core/src/main/java/org/apache/qpid/server/model/UnknownConfiguredObjectException.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/model/UnknownConfiguredObjectException.java
b/broker-core/src/main/java/org/apache/qpid/server/model/UnknownConfiguredObjectException.java
index f35a68a..f460df7 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/model/UnknownConfiguredObjectException.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/model/UnknownConfiguredObjectException.java
@@ -28,13 +28,22 @@ public class UnknownConfiguredObjectException extends IllegalArgumentException
     private String _name;
     private UUID _id;
 
-    public UnknownConfiguredObjectException(final Class<? extends ConfiguredObject>
category, final String name)
+    public UnknownConfiguredObjectException(String exceptionMessage,
+                                            final Class<? extends ConfiguredObject>
category,
+                                            final String name)
     {
-        super("Could not find object of category " + category.getSimpleName() + " with name
'" + name + "'");
+        super(exceptionMessage);
         _category = category;
         _name = name;
     }
 
+    public UnknownConfiguredObjectException(final Class<? extends ConfiguredObject>
category, final String name)
+    {
+        this("Could not find object of category " + category.getSimpleName() + " with name
'" + name + "'",
+             category,
+             name);
+    }
+
     public UnknownConfiguredObjectException(final Class<? extends ConfiguredObject>
category, final UUID id)
     {
         super("Could not find object of category " + category.getSimpleName() + " with id
" + id);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89259c2d/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
index ab5581c..9fd9b52 100644
--- a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
+++ b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
@@ -986,7 +986,7 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession>
impleme
                 {
                     exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
                 }
-                catch (IllegalConfigurationException e)
+                catch (IllegalArgumentException | IllegalConfigurationException e)
                 {
                     exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, e.getMessage());
                 }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89259c2d/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
index d2f071e..5eef253 100644
--- a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
+++ b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
@@ -83,7 +83,6 @@ import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.model.NoFactoryForTypeException;
 import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.model.Session;
 import org.apache.qpid.server.model.UnknownConfiguredObjectException;
 import org.apache.qpid.server.protocol.ErrorCodes;
 import org.apache.qpid.server.protocol.ProtocolVersion;
@@ -2723,15 +2722,11 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel,
ConsumerTarget_0
                 }
                 catch (UnknownConfiguredObjectException e)
                 {
-                    // note - since 0-8/9/9-1 can't set the alt. exchange this exception
should never occur
-                    final String message = "Unknown alternate exchange "
-                                           + (e.getName() != null
-                            ? "name: '" + e.getName() + "'"
-                            : "id: " + e.getId());
+                    final String message = String.format("Unknown alternate exchange '%s'",
e.getName());
                     _connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
 
                 }
-                catch (IllegalArgumentException e)
+                catch (IllegalArgumentException | IllegalConfigurationException e)
                 {
                     _connection.sendConnectionClose(ErrorCodes.COMMAND_INVALID, "Error creating
exchange '"
                                                                                 + exchangeName


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


Mime
View raw message