You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/01/09 15:39:58 UTC
[1/6] qpid-broker-j git commit: QPID-8061: [Broker-J] [AMQP
0-8..0-9-1] Handle unknown alternate exchange on exchange declaration
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 <or...@apache.org>
Authored: Thu Dec 7 10:33:01 2017 +0000
Committer: Keith Wall <kw...@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
[2/6] qpid-broker-j git commit: QPID-8061: Fix failing test
Posted by kw...@apache.org.
QPID-8061: Fix failing test
Cherry picked from master b3f432a
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/43edc06d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/43edc06d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/43edc06d
Branch: refs/heads/7.0.x
Commit: 43edc06de778230e375d150c5bea2cc16325b734
Parents: 89259c2
Author: Alex Rudyy <or...@apache.org>
Authored: Fri Dec 8 10:42:00 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Jan 9 14:54:21 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/server/exchange/DirectExchangeTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/43edc06d/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
index b39e959..310876f 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
@@ -39,6 +39,7 @@ import org.apache.qpid.server.model.BrokerTestHelper;
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.model.UnknownConfiguredObjectException;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
@@ -175,7 +176,7 @@ public class DirectExchangeTest extends QpidTestCase
_vhost.createChild(Exchange.class, attributes);
fail("Expected exception is not thrown");
}
- catch (IllegalConfigurationException e)
+ catch (UnknownConfiguredObjectException e)
{
// pass
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/6] qpid-broker-j git commit: QPID-8060: Fix failing test
Posted by kw...@apache.org.
QPID-8060: Fix failing test
Cherry picked from master 910f439
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/e83e43e8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/e83e43e8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/e83e43e8
Branch: refs/heads/7.0.x
Commit: e83e43e8d67c01065f1cecca3710b486d6c27d3a
Parents: ce345a7
Author: Alex Rudyy <or...@apache.org>
Authored: Fri Dec 8 10:42:17 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Jan 9 14:54:58 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/server/queue/AbstractQueueTestBase.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/e83e43e8/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
index c13edc5..45222f5 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
@@ -67,6 +67,7 @@ import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.OverflowPolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.QueueNotificationListener;
+import org.apache.qpid.server.model.UnknownConfiguredObjectException;
import org.apache.qpid.server.queue.AbstractQueue.QueueEntryFilter;
import org.apache.qpid.server.store.StoredMessage;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -981,7 +982,7 @@ abstract class AbstractQueueTestBase extends QpidTestCase
_virtualHost.createChild(Queue.class, attributes);
fail("Expected exception is not thrown");
}
- catch (IllegalConfigurationException e)
+ catch (UnknownConfiguredObjectException e)
{
// pass
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[6/6] qpid-broker-j git commit: QPID-8060: [Broker-J][AMQP 0-8..0-10]
Address review comments
Posted by kw...@apache.org.
QPID-8060: [Broker-J][AMQP 0-8..0-10] Address review comments
Cherry picked from master efb7ec0
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/9a762859
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/9a762859
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/9a762859
Branch: refs/heads/7.0.x
Commit: 9a762859553d50d0cc52cf308e3da199c0953698
Parents: 4ebbd69
Author: Alex Rudyy <or...@apache.org>
Authored: Wed Dec 27 15:49:24 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Jan 9 14:58:00 2018 +0000
----------------------------------------------------------------------
.../qpid/server/exchange/AbstractExchange.java | 4 +---
.../apache/qpid/server/queue/AbstractQueue.java | 4 +---
.../UnknownAlternateBindingException.java | 12 ++++++++++--
.../qpid/server/exchange/DirectExchangeTest.java | 5 +++--
.../qpid/server/queue/AbstractQueueTestBase.java | 5 +++--
.../protocol/v0_10/ServerSessionDelegate.java | 19 ++++++++++---------
.../qpid/server/protocol/v0_8/AMQChannel.java | 10 ++++------
7 files changed, 32 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/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 1c07178..6227384 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
@@ -1055,9 +1055,7 @@ public abstract class AbstractExchange<T extends AbstractExchange<T>>
_virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
if (messageDestination == null)
{
- throw new UnknownAlternateBindingException(String.format(
- "Cannot create alternate binding for '%s' : Alternate binding destination '%s' cannot be found.",
- getName(), destinationName));
+ throw new UnknownAlternateBindingException(destinationName);
}
else if (messageDestination == this)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
index ceb9610..09ec51c 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
@@ -3535,9 +3535,7 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>>
_virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
if (messageDestination == null)
{
- throw new UnknownAlternateBindingException(String.format(
- "Cannot create alternate binding for '%s' : Alternate binding destination '%s' cannot be found.",
- getName(), destinationName));
+ throw new UnknownAlternateBindingException(destinationName);
}
else if (messageDestination == this)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
index c3f88e6..0d3e581 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
@@ -24,8 +24,16 @@ import org.apache.qpid.server.configuration.IllegalConfigurationException;
public class UnknownAlternateBindingException extends IllegalConfigurationException
{
- public UnknownAlternateBindingException(final String message)
+ private final String _alternateBindingName;
+
+ public UnknownAlternateBindingException(final String alternateBindingName)
+ {
+ super(String.format("Alternate binding destination '%s' is not found.", alternateBindingName));
+ _alternateBindingName = alternateBindingName;
+ }
+
+ public String getAlternateBindingName()
{
- super(message);
+ return _alternateBindingName;
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
index 653a0a2..e23ed39 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
@@ -168,8 +168,9 @@ public class DirectExchangeTest extends QpidTestCase
Map<String, Object> attributes = new HashMap<>();
attributes.put(Exchange.NAME, getTestName());
attributes.put(Exchange.TYPE, ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
+ String alternateBinding = "nonExisting";
attributes.put(Exchange.ALTERNATE_BINDING,
- Collections.singletonMap(AlternateBinding.DESTINATION, "nonExisting"));
+ Collections.singletonMap(AlternateBinding.DESTINATION, alternateBinding));
try
{
@@ -178,7 +179,7 @@ public class DirectExchangeTest extends QpidTestCase
}
catch (UnknownAlternateBindingException e)
{
- // pass
+ assertEquals("Unexpected exception alternate binding", alternateBinding, e.getAlternateBindingName());
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
index e9ffcce..727f4c0 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
@@ -975,7 +975,8 @@ abstract class AbstractQueueTestBase extends QpidTestCase
{
Map<String, Object> attributes = new HashMap<>(_arguments);
attributes.put(Queue.NAME, getTestName());
- attributes.put(Queue.ALTERNATE_BINDING, Collections.singletonMap(AlternateBinding.DESTINATION, "nonExisting"));
+ String alternateBinding = "nonExisting";
+ attributes.put(Queue.ALTERNATE_BINDING, Collections.singletonMap(AlternateBinding.DESTINATION, alternateBinding));
try
{
@@ -984,7 +985,7 @@ abstract class AbstractQueueTestBase extends QpidTestCase
}
catch (UnknownAlternateBindingException e)
{
- // pass
+ assertEquals("Unexpected exception alternate binding", alternateBinding, e.getAlternateBindingName());
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/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 5af1cef..1ef431c 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
@@ -952,11 +952,12 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
+ exchangeName + " which begins with reserved name or prefix.");
}
}
- catch(UnknownAlternateBindingException e)
+ catch (UnknownAlternateBindingException e)
{
-
- exception(session, method, ExecutionErrorCode.NOT_FOUND,
- "Unknown alternate exchange " + alternateExchangeName);
+ exception(session,
+ method,
+ ExecutionErrorCode.NOT_FOUND,
+ String.format("Unknown alternate exchange '%s'", e.getAlternateBindingName()));
}
catch(NoFactoryForTypeException e)
{
@@ -1540,13 +1541,11 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
}
else
{
-
- final String alternateExchangeName = method.getAlternateExchange();
try
{
final Map<String, Object> arguments = QueueArgumentsConverter.convertWireArgsToModel(queueName,
method.getArguments());
-
+ final String alternateExchangeName = method.getAlternateExchange();
if (method.hasAlternateExchange() && !nameNullOrEmpty(alternateExchangeName))
{
validateAlternateExchangeIsNotQueue(addressSpace, alternateExchangeName);
@@ -1603,8 +1602,10 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
}
catch (UnknownAlternateBindingException e)
{
- exception(session, method, ExecutionErrorCode.NOT_FOUND,
- "Unknown alternate exchange " + alternateExchangeName);
+ exception(session,
+ method,
+ ExecutionErrorCode.NOT_FOUND,
+ String.format("Unknown alternate exchange '%s'", e.getAlternateBindingName()));
}
catch (IllegalArgumentException | IllegalConfigurationException e)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/9a762859/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 d942abd..a12b483 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
@@ -2642,7 +2642,6 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
{
String name = exchangeName.toString();
String typeString = type == null ? null : type.toString();
- String alternateExchangeName = null;
try
{
@@ -2660,7 +2659,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
Object alternateExchange = attributes.remove(ALTERNATE_EXCHANGE);
if (alternateExchange != null)
{
- alternateExchangeName = String.valueOf(alternateExchange);
+ String alternateExchangeName = String.valueOf(alternateExchange);
validateAlternateExchangeIsNotQueue(virtualHost, alternateExchangeName);
attributes.put(Exchange.ALTERNATE_BINDING,
Collections.singletonMap(AlternateBinding.DESTINATION, alternateExchangeName));
@@ -2724,7 +2723,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
}
catch (UnknownAlternateBindingException e)
{
- final String message = String.format("Unknown alternate exchange '%s'", alternateExchangeName);
+ final String message = String.format("Unknown alternate exchange '%s'", e.getAlternateBindingName());
_connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
}
@@ -3002,7 +3001,6 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
}
else
{
- String alternateExchangeName = null;
try
{
final String queueNameString = AMQShortString.toString(queueName);
@@ -3010,7 +3008,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
Object alternateExchange = wireArguments.get(ALTERNATE_EXCHANGE);
if (alternateExchange != null)
{
- alternateExchangeName = String.valueOf(alternateExchange);
+ String alternateExchangeName = String.valueOf(alternateExchange);
validateAlternateExchangeIsNotQueue(virtualHost, alternateExchangeName);
}
@@ -3131,7 +3129,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
}
catch (UnknownAlternateBindingException e)
{
- final String message = String.format("Unknown alternate exchange: '%s'", alternateExchangeName);
+ final String message = String.format("Unknown alternate exchange: '%s'", e.getAlternateBindingName());
_connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
}
catch (IllegalArgumentException | IllegalConfigurationException e)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[5/6] qpid-broker-j git commit: QPID-8060: [Broker-J] [AMQP
0-8..0-9-1] Address review comments
Posted by kw...@apache.org.
QPID-8060: [Broker-J] [AMQP 0-8..0-9-1] Address review comments
Cherry picked from master 6e83977
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/4ebbd693
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/4ebbd693
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/4ebbd693
Branch: refs/heads/7.0.x
Commit: 4ebbd693624965dd24d3007c8b2a700badfc8121
Parents: e83e43e
Author: Alex Rudyy <or...@apache.org>
Authored: Wed Dec 13 17:17:41 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Jan 9 14:56:34 2018 +0000
----------------------------------------------------------------------
.../qpid/server/exchange/AbstractExchange.java | 6 ++--
.../model/UnknownConfiguredObjectException.java | 13 ++------
.../apache/qpid/server/queue/AbstractQueue.java | 5 ++--
.../UnknownAlternateBindingException.java | 31 ++++++++++++++++++++
.../server/exchange/DirectExchangeTest.java | 4 +--
.../server/queue/AbstractQueueTestBase.java | 4 +--
.../protocol/v0_10/ServerSessionDelegate.java | 15 ++++++----
.../qpid/server/protocol/v0_8/AMQChannel.java | 21 +++++++------
8 files changed, 64 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/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 b3714e9..1c07178 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,7 +71,6 @@ 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;
@@ -85,6 +84,7 @@ import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException
import org.apache.qpid.server.virtualhost.QueueManagingVirtualHost;
import org.apache.qpid.server.virtualhost.RequiredExchangeException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
import org.apache.qpid.server.virtualhost.VirtualHostUnavailableException;
public abstract class AbstractExchange<T extends AbstractExchange<T>>
@@ -1055,9 +1055,9 @@ public abstract class AbstractExchange<T extends AbstractExchange<T>>
_virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
if (messageDestination == null)
{
- throw new UnknownConfiguredObjectException(String.format(
+ throw new UnknownAlternateBindingException(String.format(
"Cannot create alternate binding for '%s' : Alternate binding destination '%s' cannot be found.",
- getName(), destinationName), ConfiguredObject.class, destinationName);
+ getName(), destinationName));
}
else if (messageDestination == this)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/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 f460df7..f35a68a 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,22 +28,13 @@ public class UnknownConfiguredObjectException extends IllegalArgumentException
private String _name;
private UUID _id;
- public UnknownConfiguredObjectException(String exceptionMessage,
- final Class<? extends ConfiguredObject> category,
- final String name)
+ public UnknownConfiguredObjectException(final Class<? extends ConfiguredObject> category, final String name)
{
- super(exceptionMessage);
+ super("Could not find object of category " + category.getSimpleName() + " with name '" + name + "'");
_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/4ebbd693/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
index 39584d6..ceb9610 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
@@ -120,6 +120,7 @@ import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.HouseKeepingTask;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
import org.apache.qpid.server.virtualhost.QueueManagingVirtualHost;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
import org.apache.qpid.server.virtualhost.VirtualHostUnavailableException;
public abstract class AbstractQueue<X extends AbstractQueue<X>>
@@ -3534,9 +3535,9 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>>
_virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
if (messageDestination == null)
{
- throw new UnknownConfiguredObjectException(String.format(
+ throw new UnknownAlternateBindingException(String.format(
"Cannot create alternate binding for '%s' : Alternate binding destination '%s' cannot be found.",
- getName(), destinationName), ConfiguredObject.class, destinationName);
+ getName(), destinationName));
}
else if (messageDestination == this)
{
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
new file mode 100644
index 0000000..c3f88e6
--- /dev/null
+++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownAlternateBindingException.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.virtualhost;
+
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
+
+public class UnknownAlternateBindingException extends IllegalConfigurationException
+{
+ public UnknownAlternateBindingException(final String message)
+ {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
index 310876f..653a0a2 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/exchange/DirectExchangeTest.java
@@ -39,11 +39,11 @@ import org.apache.qpid.server.model.BrokerTestHelper;
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.model.UnknownConfiguredObjectException;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
import org.apache.qpid.test.utils.QpidTestCase;
public class DirectExchangeTest extends QpidTestCase
@@ -176,7 +176,7 @@ public class DirectExchangeTest extends QpidTestCase
_vhost.createChild(Exchange.class, attributes);
fail("Expected exception is not thrown");
}
- catch (UnknownConfiguredObjectException e)
+ catch (UnknownAlternateBindingException e)
{
// pass
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
index 45222f5..e9ffcce 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
@@ -67,7 +67,6 @@ import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.OverflowPolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.QueueNotificationListener;
-import org.apache.qpid.server.model.UnknownConfiguredObjectException;
import org.apache.qpid.server.queue.AbstractQueue.QueueEntryFilter;
import org.apache.qpid.server.store.StoredMessage;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -75,6 +74,7 @@ import org.apache.qpid.server.util.Action;
import org.apache.qpid.server.util.StateChangeListener;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
import org.apache.qpid.server.virtualhost.QueueManagingVirtualHost;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
import org.apache.qpid.test.utils.QpidTestCase;
abstract class AbstractQueueTestBase extends QpidTestCase
@@ -982,7 +982,7 @@ abstract class AbstractQueueTestBase extends QpidTestCase
_virtualHost.createChild(Queue.class, attributes);
fail("Expected exception is not thrown");
}
- catch (UnknownConfiguredObjectException e)
+ catch (UnknownAlternateBindingException e)
{
// pass
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/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 ccaee39..5af1cef 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
@@ -62,7 +62,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.UnknownConfiguredObjectException;
import org.apache.qpid.server.protocol.ErrorCodes;
import org.apache.qpid.server.protocol.v0_10.transport.*;
import org.apache.qpid.server.queue.QueueArgumentsConverter;
@@ -86,6 +85,7 @@ import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
import org.apache.qpid.server.virtualhost.RequiredExchangeException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
import org.apache.qpid.server.virtualhost.VirtualHostUnavailableException;
public class ServerSessionDelegate extends MethodDelegate<ServerSession> implements ProtocolDelegate<ServerSession>
@@ -952,11 +952,11 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
+ exchangeName + " which begins with reserved name or prefix.");
}
}
- catch(UnknownConfiguredObjectException e)
+ catch(UnknownAlternateBindingException e)
{
exception(session, method, ExecutionErrorCode.NOT_FOUND,
- "Unknown alternate exchange " + e.getName());
+ "Unknown alternate exchange " + alternateExchangeName);
}
catch(NoFactoryForTypeException e)
{
@@ -1541,11 +1541,9 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
else
{
+ final String alternateExchangeName = method.getAlternateExchange();
try
{
-
- final String alternateExchangeName = method.getAlternateExchange();
-
final Map<String, Object> arguments = QueueArgumentsConverter.convertWireArgsToModel(queueName,
method.getArguments());
@@ -1603,6 +1601,11 @@ public class ServerSessionDelegate extends MethodDelegate<ServerSession> impleme
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
}
+ catch (UnknownAlternateBindingException e)
+ {
+ exception(session, method, ExecutionErrorCode.NOT_FOUND,
+ "Unknown alternate exchange " + alternateExchangeName);
+ }
catch (IllegalArgumentException | IllegalConfigurationException e)
{
exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, e.getMessage());
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ebbd693/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 07d0f91..d942abd 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.UnknownConfiguredObjectException;
import org.apache.qpid.server.protocol.ErrorCodes;
import org.apache.qpid.server.protocol.ProtocolVersion;
import org.apache.qpid.server.protocol.v0_8.UnacknowledgedMessageMap.Visitor;
@@ -103,6 +102,7 @@ import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.MessageDestinationIsAlternateException;
import org.apache.qpid.server.virtualhost.RequiredExchangeException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownAlternateBindingException;
public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0_8>
implements AsyncAutoCommitTransaction.FutureRecorder,
@@ -2642,6 +2642,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
{
String name = exchangeName.toString();
String typeString = type == null ? null : type.toString();
+ String alternateExchangeName = null;
try
{
@@ -2659,9 +2660,10 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
Object alternateExchange = attributes.remove(ALTERNATE_EXCHANGE);
if (alternateExchange != null)
{
- validateAlternateExchangeIsNotQueue(virtualHost, String.valueOf(alternateExchange));
+ alternateExchangeName = String.valueOf(alternateExchange);
+ validateAlternateExchangeIsNotQueue(virtualHost, alternateExchangeName);
attributes.put(Exchange.ALTERNATE_BINDING,
- Collections.singletonMap(AlternateBinding.DESTINATION, alternateExchange));
+ Collections.singletonMap(AlternateBinding.DESTINATION, alternateExchangeName));
}
exchange = virtualHost.createMessageDestination(Exchange.class, attributes);
@@ -2720,9 +2722,9 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
_connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
}
- catch (UnknownConfiguredObjectException e)
+ catch (UnknownAlternateBindingException e)
{
- final String message = String.format("Unknown alternate exchange '%s'", e.getName());
+ final String message = String.format("Unknown alternate exchange '%s'", alternateExchangeName);
_connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
}
@@ -3000,7 +3002,7 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
}
else
{
-
+ String alternateExchangeName = null;
try
{
final String queueNameString = AMQShortString.toString(queueName);
@@ -3008,7 +3010,8 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
Object alternateExchange = wireArguments.get(ALTERNATE_EXCHANGE);
if (alternateExchange != null)
{
- validateAlternateExchangeIsNotQueue(virtualHost, String.valueOf(alternateExchange));
+ alternateExchangeName = String.valueOf(alternateExchange);
+ validateAlternateExchangeIsNotQueue(virtualHost, alternateExchangeName);
}
Map<String, Object> attributes =
@@ -3126,9 +3129,9 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
{
_connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
}
- catch (UnknownConfiguredObjectException e)
+ catch (UnknownAlternateBindingException e)
{
- final String message = String.format("Unknown alternate exchange: '%s'", e.getName());
+ final String message = String.format("Unknown alternate exchange: '%s'", alternateExchangeName);
_connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
}
catch (IllegalArgumentException | IllegalConfigurationException e)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/6] qpid-broker-j git commit: QPID-8060: [Broker-J] [AMQP
0-8..0-9-1] Handle unknown alternate exchange on queue declaration
Posted by kw...@apache.org.
QPID-8060: [Broker-J] [AMQP 0-8..0-9-1] Handle unknown alternate exchange on queue declaration
Cherry picked from master 268f3fb
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/ce345a7b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/ce345a7b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/ce345a7b
Branch: refs/heads/7.0.x
Commit: ce345a7bb08a2c257155583e11055d1935db1e3d
Parents: 43edc06
Author: Alex Rudyy <or...@apache.org>
Authored: Thu Dec 7 10:37:42 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Tue Jan 9 14:54:32 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/server/queue/AbstractQueue.java | 4 ++--
.../server/protocol/v0_10/ServerSessionDelegate.java | 2 +-
.../org/apache/qpid/server/protocol/v0_8/AMQChannel.java | 11 ++++++++++-
3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce345a7b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
index ad40049..39584d6 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
@@ -3534,9 +3534,9 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>>
_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/ce345a7b/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 9fd9b52..ccaee39 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
@@ -1603,7 +1603,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/ce345a7b/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 5eef253..07d0f91 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
@@ -3126,7 +3126,16 @@ public class AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0
{
_connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
}
-
+ catch (UnknownConfiguredObjectException e)
+ {
+ final String message = String.format("Unknown alternate exchange: '%s'", e.getName());
+ _connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId());
+ }
+ catch (IllegalArgumentException | IllegalConfigurationException e)
+ {
+ String message = String.format("Error creating queue '%s': %s", queueName, e.getMessage());
+ _connection.sendConnectionClose(ErrorCodes.COMMAND_INVALID, message, getChannelId());
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org