From efa649ad7769f96df60c6e1bfbd354f1404aed50 Mon Sep 17 00:00:00 2001 From: Danny van Heumen Date: Sun, 24 May 2015 00:38:25 +0200 Subject: Define ContactResource equality based on resourceName. (fixes OTR issue) New ContactResource instances will be created after recovering from network connectivity loss. (Initiated by suspending the system.) UI behaviour fails because ContactResource instances themselves do not have the same reference address and no custom equality was defined. --- .../service/protocol/ContactResource.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/net/java/sip/communicator/service') diff --git a/src/net/java/sip/communicator/service/protocol/ContactResource.java b/src/net/java/sip/communicator/service/protocol/ContactResource.java index 3a766b6..0969917 100644 --- a/src/net/java/sip/communicator/service/protocol/ContactResource.java +++ b/src/net/java/sip/communicator/service/protocol/ContactResource.java @@ -125,4 +125,35 @@ public class ContactResource { return mobile; } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = + prime * result + + ((resourceName == null) ? 0 : resourceName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ContactResource other = (ContactResource) obj; + if (resourceName == null) + { + if (other.resourceName != null) + return false; + } + else if (!resourceName.equals(other.resourceName)) + return false; + return true; + } } -- cgit v1.1