I have a strong suspicion that org-openide-loaders DataFolder.setSortMode(DataFolder.SortMode.LAST_MODIFIED) could lead to a racing condition in the sorting and cause something like
https://bz.apache.org/netbeans/show_bug.cgi?id=257997 java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(TimSort.java:868) at java.util.TimSort.mergeAt(TimSort.java:485) at java.util.TimSort.mergeForceCollapse(TimSort.java:426) at java.util.TimSort.sort(TimSort.java:223) at java.util.TimSort.sort(TimSort.java:173) at java.util.Arrays.sort(Arrays.java:659) at java.util.Collections.sort(Collections.java:217) at org.openide.loaders.FolderList.carefullySort(FolderList.java:600) at org.openide.loaders.FolderList.getObjects(FolderList.java:570) at org.openide.loaders.FolderList.access$600(FolderList.java:77) at org.openide.loaders.FolderList$ComparatorTask.run(FolderList.java:1028) The reason being that the file timestamp might change *while* the list if being sorted and break the comparator contract. (I also suspect that perhaps some DataObject instantiation could further delay things long enough for a timestamp to be changed but this is not really required.) FolderComparator(FolderComparator.LAST_MODIFIED) as used by DataFolder needs to be looked at perhaps. I wonder, does the filesystem prevent the timestamp from being changed during that careful sorting? Or is there some other locking preventing this? It's a bit of work but I think a test case could be created reproducing it. --emi --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
