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

REGRESSION: JOptionPane's showInternal*Dialog methods never return

XMLWordPrintable

    • b03
    • x86
    • windows_xp
    • Not verified

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      JOptionPane's showInternal*Dialog methods never return.

      When an Internal Dialog is displayed it blocks the current Thread until the Dialog is closed at which point the Thread resumes. However I have an Internal Dialog being displayed from a Thread which isn't the Dispatch Thread and despite the OK button being pressed the Thread never resumes beyond the call to JOptionPane.showInternal***Dialog.

      The problem seems to be in the java.awt.Container.startLWModal() method (lines 2633 -2639)

                      while (windowClosingException == null) {
                          try {
                              getTreeLock().wait();
                          } catch (InterruptedException e) {
                              break;
                          }
                      }

      where wait() returns but windowClosingException is always null. windowClosingException is set in two locations in java.awt.Component (lines 3933 and 4002)but only in response to a WindowClosing event not an Internal Frame closing.

      As the Thread never resumes I am unable to process the User's input and proceed. The example code provided works on JDK 1.4.1_05 and JDK 1.4.2, but not in JDK 1.5.0 beta 2, JDK 1.5.0 rc and JDK 1.5.0

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the example source code below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Using the example code below:
      System.out -> "Before showMessageDialog"
      Message Dialog Appears
      Click Message Dialog's OK button
      Message Dialog Disappears
      System.out-> "After showMessageDialog"
      System.out -> "Before showInternalMessageDialog"
      JDesktopPane containing Internal Message Dialog Appears
      Click Internal Message Dialog's OK button
      Internal Message Dialog Disappears
      System.out -> After showInternalMessageDialog
      JDesktopPane disappears
        Program exits
      ACTUAL -
      Using the example code below:
      System.out -> "Before showMessageDialog"
      Message Dialog Appears
      Click Message Dialog's OK button
      Message Dialog Disappears
      System.out-> "After showMessageDialog"
      System.out -> "Before showInternalMessageDialog"
      JDesktopPane containing Internal Message Dialog Appears
      Click Internal Message Dialog's OK button
      Internal Message Dialog Disappears


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JDesktopPane;
      import javax.swing.JFrame;
      import javax.swing.JOptionPane;

      public class OptionPaneTest
      {
          public static void main( String[] args )
          {
              System.out.println( "Before showMessageDialog" );
              JOptionPane.showMessageDialog( null, "showMessageDialog" );
              System.out.println( "After showMessageDialog" );

              JDesktopPane desktopPane = new JDesktopPane();
              JFrame frame = new JFrame();
              frame.getContentPane().add( desktopPane );
              frame.setSize( 640, 480 );
              System.out.println( "Before showInternalMessageDialog" );
              JOptionPane.showInternalMessageDialog( desktopPane, "showInternalMessageDialog" );
              System.out.println( "After showInternalMessageDialog" );

              System.exit( 0 );
          }
      }

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

      Release Regression From : 1.4.2_05
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 10/13/04 21:34 GMT

            art Artem Ananiev (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: