From 80ea5390e3c15d179188c48d0c0b3504cf657609 Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Thu, 27 Nov 2014 16:02:25 +0100 Subject: Remove most pre-sorting in the history service to avoid eliminations. The sorting introduced in commit 4c665742027d7e89f0c136d1e30ea946be2a1c0f didn't take into account that TreeSet mandates that the ordering "...must be consistent with equals if it is to correctly implement the Set interface.". This was not the case as the comparator only checks for the timestamp of a history event and as such it can have two or more events at exactly the same time (and thus ordering) which would be overwritten in the resulting set. --- .../java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/net/java/sip/communicator/impl/metahistory') diff --git a/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java index 78dac57..c8f3543 100644 --- a/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java @@ -199,7 +199,7 @@ public class MetaHistoryServiceImpl MessageProgressWrapper listenWrapper = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + LinkedList result = new LinkedList(); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -244,6 +244,7 @@ public class MetaHistoryServiceImpl } listenWrapper.fireLastProgress(startDate, endDate, null); + Collections.sort(result, new RecordsComparator()); return result; } -- cgit v1.1