Sun Defect 7075600 - "Comparison method violates its general contract!" errors - and Problems with the Work-around (Doc ID 1507950.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Java Platform, Standard Edition - Version 7 to 7 [Release 7]
Information in this document applies to any platform.
Applications started through Java Web Start included in Java SE 7 up to Java SE 7 Update 5.
It affects both 32 and 64 bit versions of Java.

Symptoms

The Java exception "java.lang.IllegalArgumentException: Comparison method violates its general contract!" can happen on applications started through Java Web Start and Java SE 7 to Java SE 7 Update 5, even with the work-around in place.  If you are hitting this issue while running applications without Java Web Start, you might be missing the work-around for Sun Bug 7075600.  See the Solution Section of this document.

The top of the stack trace related to this issue looks like:

Exception in thread "AWT-EventQueue-0" 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:653)
at java.util.Collections.sort(Collections.java:217)
at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136)
at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110)
at javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraversalPolicy.java:435)
at javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversalPolicy.java:166)
at javax.swing.SortingFocusTraversalPolicy.getDefaultComponent(SortingFocusTraversalPolicy.java:515)
at javax.swing.JComponent.requestDefaultFocus(JComponent.java:2618)
at sun.swing.SwingUtilities2.tabbedPaneChangeFocusTo(SwingUtilities2.java:1566)
at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:398)
at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
at javax.swing.plaf.basic.BasicTabbedPaneUI$Handler.mousePressed(BasicTabbedPaneUI.java:3637)
at java.awt.Component.processMouseEvent(Component.java:6427)
...

 

Changes

 Implementation of the enhancement request created through Sun Bug 6804124 in Java SE 7 or later.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms