$_SortTool.sort() violates its general contract

Jamie's Avatar


17 Mar, 2016 03:22 PM

I have seen this error a few times: "Invocation of method 'sort' in class com.hannonhill.cascade.velocity.NodeSortTool threw exception java.lang.IllegalArgumentException: Comparison method violates its general contract!" and am unsure why it occurs. Thoughts?

  1. Support Staff 1 Posted by Tim on 17 Mar, 2016 06:21 PM

    Tim's Avatar

    Hi Jamie,

    This typically happens if the field you are sorting on isn't present for one of the items in your collection. If you need help tracking it down, feel free to attach a copy of your Velocity script here along with the XML document that you're transforming.


  2. 2 Posted by Jamie on 18 Mar, 2016 06:38 PM

    Jamie's Avatar


    Thanks for clarifying that error for me. To troubleshoot, I disabled the sort and wrote the following into my Format to give me some internal information, namely, which items have an empty date field (since that is the criterion by which I am sorting):

    #foreach($newsitem in $newsitems)
    <h1>INTERNAL VIEW ONLY: ATTN: posted date = [$dateofitem]  at <a target="_blank" href="$newsitem.getParent().getChild('link').value">$newsitem.getParent().getChild('path').value</a> </h1>

    I was able to ensure a date was in the items reported and now all is fine.

    Thanks again!


  3. Support Staff 3 Posted by Tim on 18 Mar, 2016 06:41 PM

    Tim's Avatar

    Perfect. Thanks for the update, Jamie! Glad to hear you were able to resolve this.

  4. Tim closed this discussion on 18 Mar, 2016 06:41 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac


26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM