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

Uncaught exceptions in JComboBox listeners cause listener not to receive events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 7u21, 8, 9
    • client-libs
    • b127
    • windows_7

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.7.0_21-b11)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 6.1.7601

      A DESCRIPTION OF THE PROBLEM :
      If an uncaught exception is thrown inside an action listener for a JComboBox, that action listener will no longer receive action events. Note that if an uncaught exception is throws inside the action listener for a JButton for example, the listener will still receive subsequent action events.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.JComboBox;
      import javax.swing.JFrame;

      public class Test {

          public static void main(String[] args) {
      JFrame frame = new JFrame();
      final JComboBox cb = new JComboBox(new String[] { " a " , " b " , " c " , " d " , " e " });
      // JButton cb = new JButton( " sdf " );
      cb.addActionListener(new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
      System.out.println( " actionPerformed " );
      throw new RuntimeException();

          }
      });
      frame.getContentPane().add(cb);
      frame.setSize(500, 500);
      frame.setVisible(true);
          }

      }

      ---------- END SOURCE ----------

            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: