From 51814d927bb54b52bf19dc6745a333cebf0757ee Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 25 Sep 2011 23:26:50 +0000 Subject: QPID-3444: issue an invalid argument execution exception if the exchange name is null or the empty string. Update some constants to ensure the error code is logged with the correct message git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1175625 13f79535-47bb-0310-9956-ffa450edef68 --- .../server/handler/BasicConsumeMethodHandler.java | 2 +- .../server/transport/ServerSessionDelegate.java | 27 ++++++++++++++++------ .../client/handler/ChannelCloseMethodHandler.java | 2 +- .../ChannelCloseMethodHandlerNoCloseOk.java | 2 +- .../apache/qpid/AMQInvalidArgumentException.java | 2 +- .../java/org/apache/qpid/protocol/AMQConstant.java | 7 ++---- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java index a5999711bc..765dee2878 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java @@ -144,7 +144,7 @@ public class BasicConsumeMethodHandler implements StateAwareMethodListener> registeredTypes) { for(ExchangeType type : registeredTypes) @@ -687,9 +703,9 @@ public class ServerSessionDelegate extends SessionDelegate { exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "queue not set"); } - else if (!method.hasExchange()) + else if (nameNullOrEmpty(method.getExchange())) { - exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "exchange not set"); + exception(session, method, ExecutionErrorCode.INVALID_ARGUMENT, "Bind not allowed for default exchange"); } /* else if (!method.hasBindingKey()) @@ -758,9 +774,9 @@ public class ServerSessionDelegate extends SessionDelegate { exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "queue not set"); } - else if (!method.hasExchange()) + else if (nameNullOrEmpty(method.getExchange())) { - exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "exchange not set"); + exception(session, method, ExecutionErrorCode.INVALID_ARGUMENT, "Unbind not allowed for default exchange"); } else if (!method.hasBindingKey()) { @@ -790,9 +806,6 @@ public class ServerSessionDelegate extends SessionDelegate } } } - - - super.exchangeUnbind(session, method); } @Override diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java index 2cf19bf391..b9d4d6fa95 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java @@ -78,7 +78,7 @@ public class ChannelCloseMethodHandler implements StateAwareMethodListener