-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error parsing WhatsApp DB (Comparison method violates its general contract) #2337
Comments
Out of curiosity, the problem is caused when we try to sort items and some of them don't have a "linear" order (A > B, B > C and C > A). public int compareTo(Message o) {
if (a != 0 && o.a != 0) {
int cmp = Integer.compare(a, o.a);
if (cmp != 0) return cmp;
}
if (b != 0 && o.b != 0) {
int cmp = Integer.compare(b, o.b);
if (cmp != 0) return cmp;
}
return Integer.compare(c, o.c);
} If we have items like X = {a=0, b=2, c=1}, Y = {a=2, b=1, c=0}, Z = {a=1, b=0, c=2}, then: |
Fix sorting of WhatsApp messages (#2337 complement)
Closed by #2352. |
Sorry @lfcnassif, but I will reopen this once again, as there is still an issue when backups are merged. |
Don't worry and thank you @wladimirleite for continuously checking the changes. I thought this could be very tricky when merging DBs with different sorting criteria, but didn't test the changes, I'm sorry about that. |
Sort messages properly, after merging process (Additional fix to #2337)
Another user reported the following error (it happens both with 4.1.x and master).
Analysing the database, the issue is caused by the way messages are sorted.
It may fail when a very specific combination of records (with zeroes or null values in the columns used) is present, which is the case of the triggering database.
I will submit a fix shortly.
The text was updated successfully, but these errors were encountered: