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

JList cause an exception when exclusively add data to the list

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 5.0, 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux, windows_xp

      Description

      FULL PRODUCT VERSION :
      Java 1.5.0_02b09

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I don't think this would cause an error

      A DESCRIPTION OF THE PROBLEM :
      When I tried to add a lot of data to the List, it caused the exception below.

      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 59614
      at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1155)
      at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1098)
      at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:234)
      at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
      at javax.swing.JComponent.paintComponent(JComponent.java:740)
      at javax.swing.JComponent.paint(JComponent.java:1003)
      at javax.swing.JComponent.paintChildren(JComponent.java:840)
      at javax.swing.JComponent.paint(JComponent.java:1012)
      at javax.swing.JComponent.paintChildren(JComponent.java:840)
      at javax.swing.JComponent.paint(JComponent.java:1012)
      at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
      at javax.swing.JComponent.paintChildren(JComponent.java:840)
      at javax.swing.JComponent.paint(JComponent.java:1012)
      at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4930)
      at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4883)
      at javax.swing.JComponent._paintImmediately(JComponent.java:4826)
      at javax.swing.JComponent.paintImmediately(JComponent.java:4633)
      at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
      at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the given code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Cause an exception I had described above.

      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 59614
      at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1155)
      at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1098)
      at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:234) ...
      ACTUAL -
      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 59614
      at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1155)
      at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1098)
      at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:234) ...

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 59614
      at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1155)
      at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1098)
      at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:234) ...

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      import java.awt.Color;
      import java.awt.Component;
      import java.util.ArrayList;

      import javax.swing.AbstractListModel;
      import javax.swing.DefaultListModel;
      import javax.swing.JFrame;
      import javax.swing.JLabel;
      import javax.swing.JList;
      import javax.swing.ListCellRenderer;

      public class Sample extends Thread {
      private DefaultListModel model;

      Sample(DefaultListModel model) {
      this.model = model;
      }

      @Override
      public void run() {
      long l = 0;
      while (true) {
      model.addElement(String.valueOf(l++));
      }
      }

      public static void main(String[] args) {
      JList list = new JList();

      DefaultListModel model = new DefaultListModel();
      list.setModel(model);

      JFrame frm = new JFrame();
      frm.getContentPane().add(list);

      frm.pack();
      frm.setVisible(true);
      frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      new Sample(model).start();
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I don't have any anternative choice...

      I have to wait for your patch ... T_T
      ###@###.### 2005-04-12 06:40:44 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: