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

If JPopupMenu.setVisible throws an Exception interaction with GNOME is crippled

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b07
    • CPU:
      x86
    • OS:
      solaris_10
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"

      ADDITIONAL OS VERSION INFORMATION :
      SunOS ahum2 5.10 Generic_Patch_118844-30 i86pc i386 i86pc


      A DESCRIPTION OF THE PROBLEM :
      I ran into this while devising a patch. If during the process of making a JPopupMenu visible an exeception is thrown interaction with the GNOME desktop appears to cease. I cannot click outside of the Java window, only inside of it. Im not sure if this is limited to GNOME/X but it certainly has an affect. Note, Ive target the setVisible method. It may well other methods in the call stack can cause this since Im uncertain as to the general cause beyond an exception at one point.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run this test on GNOME, see if your desktop become unresponsive.

      PRESS THE EXIT BUTTON TO CLOSE THE WINDOW AND STOP THE UNREPSONSIVENESS

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      That the GNOME desktop won't be blocked.
      ACTUAL -
      its blocked

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.AssertionError: What happened!!!
              at BoomJPopupMenu$1.setVisible(BoomJPopupMenu.java:12)
              at javax.swing.JPopupMenu.menuSelectionChanged(JPopupMenu.java:1438)
              at javax.swing.MenuSelectionManager.setSelectedPath(MenuSelectionManager.java:95)
              at javax.swing.MenuSelectionManager.clearSelectedPath(MenuSelectionManager.java:127)
              at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.cancelPopupMenu(BasicPopupMenuUI.java:841)
              at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.eventDispatched(BasicPopupMenuUI.java:773)
              at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2360)
              at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2252)
              at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2210)
              at java.awt.Component.dispatchEventImpl(Component.java:4308)
              at java.awt.Container.dispatchEventImpl(Container.java:2116)
              at java.awt.Component.dispatchEvent(Component.java:4240)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3983) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
              at java.awt.Container.dispatchEventImpl(Container.java:2102)
              at java.awt.Window.dispatchEventImpl(Window.java:2429)
              at java.awt.Component.dispatchEvent(Component.java:4240)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class BoomJPopupMenu implements Runnable{

          public void run(){
      JPanel jp = new JPanel();
              JPopupMenu jpm = new JPopupMenu(){
      public void setVisible(boolean visible){
                          super.setVisible(visible);
                          throw new AssertionError("What happened!!!");
                      }
      };
              for(int i = 0; i < 10; i ++)
                  jpm.add(new JMenuItem(String.valueOf(i)));
              jp.setComponentPopupMenu(jpm);
              JFrame jf = new JFrame();
              jf.add(jp);
              JButton jb = new JButton("Exit");
              jb.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
                          System.exit(0);
                      }
      });
              jf.add(jb, BorderLayout.SOUTH);
              jf.setSize(500,500);
              jf.setVisible(true);
          }

          public static void main(String ... args){
              SwingUtilities.invokeLater(new BoomJPopupMenu());
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      maybe instrument setVisible to grab exceptions

        Attachments

          Activity

            People

            Assignee:
            mlapshin Mikhail Lapshin (Inactive)
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: