United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7075600 : IllegalArgumentException throws when running apps

Details
Type:
Bug
Submit Date:
2011-08-05
Status:
Closed
Updated Date:
2015-04-06
Project Name:
JDK
Resolved Date:
2015-04-06
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
7
Fixed Versions:
9

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
Get the follow reproduible exception with Java 7 on Windows when running attached designer.zip apps:
 

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.mergeCollapse(TimSort.java:410)
      at java.util.TimSort.sort(TimSort.java:214)
      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 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:1577)
      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:3643)
      at javax.swing.plaf.synth.SynthTabbedPaneUI$1.mousePressed(SynthTabbedPaneUI.java:314)
      at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
      at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
      at java.awt.Component.processMouseEvent(Component.java:6501)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
      at java.awt.Component.processEvent(Component.java:6269)
      at java.awt.Container.processEvent(Container.java:2229)
      at java.awt.Component.dispatchEventImpl(Component.java:4860)
      at java.awt.Container.dispatchEventImpl(Container.java:2287)
      at java.awt.Component.dispatchEvent(Component.java:4686)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4489)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      at java.awt.Container.dispatchEventImpl(Container.java:2273)
      at java.awt.Window.dispatchEventImpl(Window.java:2713)
      at java.awt.Component.dispatchEvent(Component.java:4686)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
      at java.awt.EventQueue.access$000(EventQueue.java:101)
      at java.awt.EventQueue$3.run(EventQueue.java:666)
      at java.awt.EventQueue$3.run(EventQueue.java:664)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:680)
      at java.awt.EventQueue$4.run(EventQueue.java:678)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)



Steps to reproduce it:
??         double click startDesigner.bat and wait some seconds
??         drag the *.rpt file in the root into the desktop pane
??         MsgBox --> OK
??         Click on the "Result" tab
??         Error Box --> ok
??         Click on the "Design" tab
??         In the console you see the stacktrace of the bug. You can see repeatly the exception if you switch between "Result" tab and "Design" tab.

                                    

Comments
closed to follow the status from bugDB
                                     
2015-04-06
 - this is an issue reported against 7(7u),
 - there are now affected version 9 filed for this issue
 - 7u issues are transferred to Sustaining
Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9
or
7u specific escalations might be reopen to Sustaining
                                     
2014-08-10
Comment from the CAP member - 

The setting of this property is not a solution for us. Also many other people have the same problem.

If you know that you need to call the old sorting algorithm, why you does not call it directly via reflection of Arrays.legacyMergeSort. Or make the method public.

                                     
2014-06-12
See also http://stackoverflow.com/questions/13575224/comparison-method-violates-its-general-contract-timsort-and-gridlayout
                                     
2014-04-22
Hello Anton, Victor,

If I am not wrong this issue is in client-libs? Basically bugdb issue exists because they are not able to use the workaround available throught jnlp due to some security changes we did. 
Basically we need to fix the bug in client-libs to fix the bugdb issue.

Does this sound right or am I missing something?

Assigning to Anton for now.

Regards,
Nakul
                                     
2014-04-01
assigned to sust as bugdb assignment and was labeled also
                                     
2014-03-11
ILW = MML => P4
                                     
2014-01-27
I think implementing our own sorting is not a bad idea. We can give it a try and see how it hits performance.
                                     
2014-01-09
> It can result in performance regression, though, so it's unlikely to be implemented. 
Is it a subject to close as WillNotFix?
                                     
2013-12-24
We can't change ROW_TOLERANCE in the layout policy, as it's a feature. We also can't change the default sorting algorithm. The only possible solution is to use our own custom sorting. It can result in performance regression, though, so it's unlikely to be implemented.
                                     
2013-09-30
As a workaround, set java.util.Arrays.useLegacyMergeSort system property to true.
                                     
2013-08-26
WORK AROUND

java.util.Arrays.useLegacyMergeSort property could be used.
                                     
2012-05-11
EVALUATION

This bug duplicates 6923200. The latter though was closed due to unability to reproduce the problem. Now there's the test case.
The core of the issue is described here: 5070991. It lies in breaking the transitivity rule because of the RAW_TOLERANCE conception used by LayoutComparator.
The problem has also been discussed on the forum: http://www.java.net/node/700601
                                     
2011-08-17



Hardware and Software, Engineered to Work Together