You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like I goofed in a priority comparison method.
Offending comparison:
public int compare(Trip lhs, Trip rhs) {
return (lhs.getPriority() < rhs.getPriority()) ? 1 : -1;
}
Violates the contract of comparitors, because if the priorities are equal, -1 will be returned, which denotes that one side is greater.
This is obviously incorrect.
Also, it's a simple fix.
User reports this happened with screen off when notification sounded. I think it was when he turned on his phone, all the priorities got recalculated and reordered, revealing this issue.
It was likely for priorities to be exactly equal because each trip in a stop has identical priority.
USER_COMMENT=alarm sounded when the screen was off
ANDROID_VERSION=4.4.2
APP_VERSION_NAME=0.71
BRAND=MetroPCS
PHONE_MODEL=LGMS323
CUSTOM_DATA=
STACK_TRACE=java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(TimSort.java:864)
at java.util.TimSort.mergeAt(TimSort.java:481)
at java.util.TimSort.mergeForceCollapse(TimSort.java:422)
at java.util.TimSort.sort(TimSort.java:219)
at java.util.TimSort.sort(TimSort.java:169)
at java.util.Arrays.sort(Arrays.java:2023)
at java.util.Collections.sort(Collections.java:1883)
at com.remulasce.lametroapp.c.b.a(ServiceRequestHandler.java:39)
at com.remulasce.lametroapp.c.b.a(ServiceRequestHandler.java:51)
at com.remulasce.lametroapp.p.a(TripPopulator.java:226)
at com.remulasce.lametroapp.p.run(TripPopulator.java:195)
at java.lang.Thread.run(Thread.java:841)
The text was updated successfully, but these errors were encountered:
Looks like I goofed in a priority comparison method.
Offending comparison:
public int compare(Trip lhs, Trip rhs) {
return (lhs.getPriority() < rhs.getPriority()) ? 1 : -1;
}
Violates the contract of comparitors, because if the priorities are equal, -1 will be returned, which denotes that one side is greater.
This is obviously incorrect.
Also, it's a simple fix.
User reports this happened with screen off when notification sounded. I think it was when he turned on his phone, all the priorities got recalculated and reordered, revealing this issue.
It was likely for priorities to be exactly equal because each trip in a stop has identical priority.
USER_COMMENT=alarm sounded when the screen was off
ANDROID_VERSION=4.4.2
APP_VERSION_NAME=0.71
BRAND=MetroPCS
PHONE_MODEL=LGMS323
CUSTOM_DATA=
STACK_TRACE=java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(TimSort.java:864)
at java.util.TimSort.mergeAt(TimSort.java:481)
at java.util.TimSort.mergeForceCollapse(TimSort.java:422)
at java.util.TimSort.sort(TimSort.java:219)
at java.util.TimSort.sort(TimSort.java:169)
at java.util.Arrays.sort(Arrays.java:2023)
at java.util.Collections.sort(Collections.java:1883)
at com.remulasce.lametroapp.c.b.a(ServiceRequestHandler.java:39)
at com.remulasce.lametroapp.c.b.a(ServiceRequestHandler.java:51)
at com.remulasce.lametroapp.p.a(TripPopulator.java:226)
at com.remulasce.lametroapp.p.run(TripPopulator.java:195)
at java.lang.Thread.run(Thread.java:841)
The text was updated successfully, but these errors were encountered: