Miroslav Holubec created ISIS-3315:
--------------------------------------

             Summary: Apache Isis sorting fails with Comparison method violates 
its general contract!
                 Key: ISIS-3315
                 URL: https://issues.apache.org/jira/browse/ISIS-3315
             Project: Isis
          Issue Type: Bug
          Components: Isis Core
    Affects Versions: 2.0.0-M7
         Environment: OpenJDK 64-Bit Server VM Temurin-18+36 (build 18+36, 
mixed mode, sharing)

            Reporter: Miroslav Holubec


Apache ISIS own comparator fails with IllegalArgumentException sorting our 
data. I've created a [sample 
snippet|https://gist.github.com/myroch/c26b97ec83e9168176e43b2ced4f9a08] to 
proof this.

The comparator used in the snippet is that one from 
ManagedObjects.NATURAL_NULL_FIRST, I've just put for simplicity the complexity 
of ManagedObject away.

Occured on 2.0.0-M7, but as I checked the code this affects propably all 2.0.0 
versions

Stacktrace:
{noformat}
Caused by: java.lang.IllegalArgumentException: Comparison method violates its 
general contract!
        at java.util.TimSort.mergeLo(TimSort.java:781) ~[?:?]
        at java.util.TimSort.mergeAt(TimSort.java:518) ~[?:?]
        at java.util.TimSort.mergeCollapse(TimSort.java:448) ~[?:?]
        at java.util.TimSort.sort(TimSort.java:245) ~[?:?]
        at java.util.Arrays.sort(Arrays.java:1307) ~[?:?]
        at java.util.ArrayList.sort(ArrayList.java:1721) ~[?:?]
        at 
org.apache.isis.commons.collections.Can_Multiple.sorted(Can_Multiple.java:121) 
~[isis-commons-2.0.0-M7.jar:2.0.0-M7]
        at 
org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsSortableDataProvider.sorted(CollectionContentsSortableDataProvider.java:83)
 ~[isis-viewer-wicket-ui-2.0.0-M7.jar:2.0.0-M7]
        at 
org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsSortableDataProvider.iterator(CollectionContentsSortableDataProvider.java:73)
 ~[isis-viewer-wicket-ui-2.0.0-M7.jar:2.0.0-M7]
        at 
org.apache.wicket.markup.repeater.data.DataViewBase$ModelIterator.<init>(DataViewBase.java:107)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.markup.repeater.data.DataViewBase.getItemModels(DataViewBase.java:74)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.markup.repeater.AbstractPageableView.getItemModels(AbstractPageableView.java:99)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:93)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:124)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:113)
 ~[wicket-core-8.13.0.jar:8.13.0]
        at org.apache.wicket.Component.beforeRender(Component.java:947) 
~[wicket-core-8.13.0.jar:8.13.0]
        at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1741)
 ~[wicket-core-8.13.0.jar:8.13.0]
        ... 107 more
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to