From a5fe06779d2c196ea954fc91a79dcba18203e38e Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Wed, 13 Mar 2013 15:39:24 +0000 Subject: QPID-3769 Modified the hashcode impl to match equals. Added a test case to verify equals and hashcode for ADDR based destinations. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1456008 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/qpid/client/AMQDestination.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'qpid/java/client/src/main') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java index 58f7a465be..6ca2988186 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java @@ -676,13 +676,19 @@ public abstract class AMQDestination implements Destination, Referenceable public int hashCode() { int result; - result = _exchangeName == null ? "".hashCode() : _exchangeName.hashCode(); - result = 29 * result + (_exchangeClass == null ? "".hashCode() :_exchangeClass.hashCode()); - if (_queueName != null) + if (_destSyntax == DestSyntax.ADDR) { - result = 29 * result + _queueName.hashCode(); + result = 29 * _addressType + _name.hashCode(); + } + else + { + result = _exchangeName == null ? "".hashCode() : _exchangeName.hashCode(); + result = 29 * result + (_exchangeClass == null ? "".hashCode() :_exchangeClass.hashCode()); + if (_queueName != null) + { + result = 29 * result + _queueName.hashCode(); + } } - return result; } -- cgit v1.2.1