Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6923200

swing LayoutComparator breaks transitivity that may lead to IllegalArgumentException

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2
    • Resolution: Cannot Reproduce
    • 7
    • None
    • client-libs
    • None
    • generic
    • generic

    Description

      As described in 5070991, swing LayoutComparator used by LayoutFocusTraversalPolicy breaks the transitivity requirement.
      In jdk7 b70 the mergesort algorithm has been modified (see 6804124). Now it may lead to IllegalArgumentException
      as described on this forum thread:

      http://forums.java.net/jive/thread.jspa?messageID=384566

      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)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
      at java.awt.Component.processEvent(Component.java:6195)
      at java.awt.Container.processEvent(Container.java:2203)
      at java.awt.Component.dispatchEventImpl(Component.java:4790)
      at java.awt.Container.dispatchEventImpl(Container.java:2261)
      at java.awt.Component.dispatchEvent(Component.java:4616)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4800)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4460)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
      at java.awt.Container.dispatchEventImpl(Container.java:2247)
      at java.awt.Window.dispatchEventImpl(Window.java:2671)
      at java.awt.Component.dispatchEvent(Component.java:4616)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:651)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:255)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:170)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:155)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:136)

      Attachments

        Issue Links

          Activity

            People

              dav Andrei Dmitriev (Inactive)
              ant Anton Tarasov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: