This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205828 - IllegalArgumentException: Comparison method violates its general contract!
Summary: IllegalArgumentException: Comparison method violates its general contract!
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Martin Entlicher
: 206473 (view as bug list)
Depends on:
Reported: 2011-12-02 09:36 UTC by turneliusz
Modified: 2012-01-03 15:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 183359

stacktrace (4.06 KB, text/plain)
2011-12-02 09:36 UTC, turneliusz
Dump of variables (10.14 KB, text/plain)
2011-12-02 11:09 UTC, turneliusz
Screenshot (52.62 KB, image/png)
2011-12-02 11:10 UTC, turneliusz
The file that can be used to reproduce this bug (10.63 KB, application/x-php)
2011-12-16 10:56 UTC, Martin Entlicher
The proposed API change that solves inconsistent values during sorting process.. (7.97 KB, patch)
2011-12-16 19:09 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description turneliusz 2011-12-02 09:36:27 UTC
Build: NetBeans IDE Dev (Build 201111290600)
VM: Java HotSpot(TM) 64-Bit Server VM, 21.1-b02, Java(TM) SE Runtime Environment, 1.7.0_01-b08
OS: Windows 7

User Comments:
turneliusz: debugging, "variables" tab, sorting by value

java.lang.IllegalArgumentException: Comparison method violates its general contract!
   at java.util.TimSort.mergeHi(
   at java.util.TimSort.mergeAt(
   at java.util.TimSort.mergeCollapse(
   at java.util.TimSort.sort(
   at java.util.TimSort.sort(
   at java.util.Arrays.sort(
Comment 1 turneliusz 2011-12-02 09:36:30 UTC
Created attachment 113739 [details]
Comment 2 turneliusz 2011-12-02 11:09:53 UTC
Created attachment 113748 [details]
Dump of variables
Comment 3 turneliusz 2011-12-02 11:10:07 UTC
Created attachment 113750 [details]
Comment 4 Martin Entlicher 2011-12-02 12:41:10 UTC
Thanks for the dump of variables, we'll hopefully reproduce it with them...
Comment 5 Martin Entlicher 2011-12-16 10:53:56 UTC
*** Bug 206473 has been marked as a duplicate of this bug. ***
Comment 6 Martin Entlicher 2011-12-16 10:56:17 UTC
Created attachment 114260 [details]
The file that can be used to reproduce this bug

I've successfully reproduced this bug on the provided data.
Comment 7 Martin Entlicher 2011-12-16 12:56:14 UTC
The bug is caused by items that do not manage to evaluate fast enough and return "Evaluating..." value until the real value is retrieved.
This corrupts the sorting in cases when a variable returns "Evaluating..." during one comparison and the real value during another comparison. This breaks the consistency.
The fix should be to make sure that all variables are fully evaluated before the sorting takes place and also to assure that the variable values can not change until the sorting is finished.
Comment 8 Martin Entlicher 2011-12-16 19:09:11 UTC
Created attachment 114276 [details]
The proposed API change that solves inconsistent values during sorting process..
Comment 9 Martin Entlicher 2011-12-16 19:11:28 UTC
Please review the attached simple API change that allows to cache the transformed model values during the sorting process. The caching assures that the data can not change during sorting.
Comment 10 Martin Entlicher 2011-12-16 19:24:02 UTC
FYI: This change solves the exception, but some rows may end up unsorted (those that happen to get the "Evaluating..." text). To solve the sorting in this case, I've submitted issue #206486.
Comment 11 Quality Engineering 2011-12-20 15:56:43 UTC
Integrated into 'main-golden'
Log: #205828 Make the comparison symmetric.
Comment 12 Martin Entlicher 2012-01-02 13:04:57 UTC
Thanks for the review, the fix is pushed as changeset:   209630:8c344093bcfa
Comment 13 Quality Engineering 2012-01-03 15:44:08 UTC
Integrated into 'main-golden'
Log: #205828 RowMapping.getTransformedValue() method is introduced to assure that we retrieve every cell value only once per any number of calls.