summaryrefslogtreecommitdiff
path: root/qpid/java/client/src/main
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2013-03-13 15:39:24 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2013-03-13 15:39:24 +0000
commita5fe06779d2c196ea954fc91a79dcba18203e38e (patch)
treec9f6e4b4b2fae2a684082c2976b78a50296cf393 /qpid/java/client/src/main
parent24a380383777903d18ae5d6d535bc0dda23f05f6 (diff)
downloadqpid-python-a5fe06779d2c196ea954fc91a79dcba18203e38e.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@1456008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/main')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java16
1 files changed, 11 insertions, 5 deletions
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;
}