[jitsi-dev] [jitsi] Contacts with several same prioritized resources sometimes show wrong overall status (#182)


#1

I'm opening this separate issue thread for the bug mentioned [here] (http://lists.jitsi.org/pipermail/users/2015-October/010175.html) and [here] (https://github.com/jitsi/jitsi/pull/161)

The bug lies [here] (https://github.com/459below/jitsi/blob/fix-callbutton/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java#L1527)

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/issues/182


#2

I've implemented two alternatives.

[This] (https://github.com/459below/jitsi/commit/e814fafcceeb297d4256f9086064c1dc4eb20d75) one changes the TreeSet to a HashMap, which then gets sorted to determine the highest priority.

But i wasn't very happy with the result. So I resolved the issue [here](https://github.com/459below/jitsi/commit/a4892d4b07b335312fbd4461a462b0df01924823) in a different way. I haven't found a way to sort a set in a significant simpler way, than the TreeSet already used here. So instead I modified the Comparator function to make sure it will never deem two objects equal. And since there sometimes just is no way to establish a greater or less than relationship of two priorities or presences, it shouldn't matter at all in what order those same prioritized Presence objects are represented in the TreeSet.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/issues/182#issuecomment-155547790


#3

I like the changed comparator version better because the changeset is smaller. But up to you from which you want to create a PR.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/issues/182#issuecomment-155601598


#4

I agree. I've [improved](https://github.com/459below/jitsi/commit/20b101276d2e35ab2c54b1cf7a8b673377ec9a31) the draft implementation to make it *consistent with equals*. I also agree with what you said before, about a *Set* being the wrong choice here but rather a *SortedList*. I've searched the whole project for *TreeSets* and skimmed over the code. Some of those could also suffer from the same issue. I think in the long term those *TreeSets* should be weeded out.

However in the short term I want to go with the smaller fix, since it should be less prone to bugs. I will test it a little bit more and then create the PR.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/issues/182#issuecomment-155638847


#5

Closed #182 via #185.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/issues/182#event-467777518