summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGurmeen Bindra <gurmeen.bindra@isode.com>2012-09-07 08:30:37 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-09-07 08:36:43 (GMT)
commita39457d1c736edf4666808906e8c0c7158f2b903 (patch)
tree4332826d34bafe04a3b1847c5f4bf91416f5b9e3 /src/com/isode/stroke/jid/JID.java
parent33648cee9778a0ce73fa17f0bba4069896615f95 (diff)
downloadstroke-a39457d1c736edf4666808906e8c0c7158f2b903.zip
stroke-a39457d1c736edf4666808906e8c0c7158f2b903.tar.bz2
Correct the equals method of JID class
The method was comparing the classes instead of instances as a result of which equal JIDs but belonging to different derived class were always unequal. Test-information: Tested using an XMPP client which is using objects of class derived from JID class to compare with raw JID objects
Diffstat (limited to 'src/com/isode/stroke/jid/JID.java')
-rw-r--r--src/com/isode/stroke/jid/JID.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/isode/stroke/jid/JID.java b/src/com/isode/stroke/jid/JID.java
index acd1430..490a65d 100644
--- a/src/com/isode/stroke/jid/JID.java
+++ b/src/com/isode/stroke/jid/JID.java
@@ -218,13 +218,13 @@ public class JID implements Comparable<JID> {
}
@Override
- public boolean equals(final Object otherObject) {
- if (otherObject == null || getClass() != otherObject.getClass()) {
- return false;
- }
+ public boolean equals(final Object otherObject) {
if (otherObject == this) {
return true;
}
+ if (!(otherObject instanceof JID)) {
+ return false;
+ }
JID other = (JID)otherObject;
String node1 = getNode();
String node2 = other.getNode();