From da72aa65700d14285617477b8958b5bd5924d1b7 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Mon, 24 Feb 2014 16:09:46 -0500 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5075 --- .../activemq/transport/amqp/AmqpProtocolConverter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java index 7e249575b2..a1730c02bd 100644 --- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java +++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import javax.jms.InvalidClientIDException; import javax.jms.InvalidSelectorException; import org.apache.activemq.command.ActiveMQDestination; @@ -426,7 +427,13 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter { if (response.isException()) { Throwable exception = ((ExceptionResponse) response).getException(); - protonConnection.setCondition(new ErrorCondition(AmqpError.UNAUTHORIZED_ACCESS, exception.getMessage())); + if (exception instanceof SecurityException) { + protonConnection.setCondition(new ErrorCondition(AmqpError.UNAUTHORIZED_ACCESS, exception.getMessage())); + } else if (exception instanceof InvalidClientIDException) { + protonConnection.setCondition(new ErrorCondition(AmqpError.INVALID_FIELD, exception.getMessage())); + } else { + protonConnection.setCondition(new ErrorCondition(AmqpError.ILLEGAL_STATE, exception.getMessage())); + } protonConnection.close(); pumpProtonToSocket(); amqpTransport.onException(IOExceptionSupport.create(exception));