Java Exception: "Comparison method violates its general contract" when sorting "E-mail Address" column
search cancel

Java Exception: "Comparison method violates its general contract" when sorting "E-mail Address" column

book

Article ID: 135873

calendar_today

Updated On:

Products

CA Identity Manager CA Identity Suite

Issue/Introduction

This article describes an issue in Identity Manager where a Java exception occurs during sorting operations in the User Console. This typically manifests when an administrator or user attempts to sort search results by the email address attribute.

Environment

Identity Manager 14.5

Cause

The error java.lang.IllegalArgumentException: Comparison method violates its general contract! is triggered by the TimSort algorithm, which became the default sorting mechanism in Java 7. TimSort throws this exception if it detects inconsistent comparison logic, such as:

  • Attributes containing only a space character.
  • Inconsistent null values across the sortable dataset.
  • Data entries with leading or trailing spaces in the source LDAP repository

Resolution

  1. Log in to the source repository (e.g., LDAP via CA Directory) used by Identity Manager.
  2. Search for user entries where the E-mail Address attribute contains a space value (' ').
  3. Modify the affected entries to provide a valid email string or delete the entries if they are invalid.
  4. Technical Improvement: If data cleanup is not immediately possible, force the application to use the legacy merge sort by adding the following to your JVM startup arguments:
    • -Djava.util.Arrays.useLegacyMergeSort=true 

Additional Information

To speak with a customer representative or a Support Engineer see Contact Support. Scroll to the bottom of the page and click on your respective region.