diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2013-03-13 15:39:24 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2013-03-13 15:39:24 +0000 |
| commit | dc824fd68a48a61d276278cda9853a7e90e48290 (patch) | |
| tree | ec24c18e369ebcb05343af30272996b1fc265bde /java/client/src/main | |
| parent | 64c6a025c4e8c844f880854ad43364ba828ff614 (diff) | |
| download | qpid-python-dc824fd68a48a61d276278cda9853a7e90e48290.tar.gz | |
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/qpid@1456008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/main')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQDestination.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java b/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java index 58f7a465be..6ca2988186 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java +++ b/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; } |
