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

realSync throws InfiniteLoop some times.

XMLWordPrintable

    • generic, x86, sparc
    • generic, solaris_10, windows_xp, windows_vista

      Here's a test case:

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;
      /*
       * @test %I% %E%
       * @bug 4942216
       * @summary Tests 4942216
       * @library ../../../../javax/swing/regtesthelpers
       * @build SwingTestHelper Test JRobot Assert
       * @run main bug4942216
       * @author Scott Violet
       */
      public class bug4942216 extends SwingTestHelper {
          private JTextField textField;

          public static void main(String[] args) throws Throwable {
              new bug4942216().run(args);
          }

          protected Component createContentPane() {
              textField = new JTextField();
              textField.setAutoscrolls(true);
              return textField;
          }

          public void onEDT10() {
              robot.moveMouseTo(textField);
              robot.mousePress(InputEvent.BUTTON1_MASK);
              waitForEvent(textField, MouseEvent.MOUSE_PRESSED);
          }

          public void onEDT20() {
              Point loc = textField.getLocationOnScreen();
              robot.mouseMove(loc.x + textField.getWidth() + 10,
                              loc.y + textField.getHeight() + 10);
              waitForEvent(textField, MouseEvent.MOUSE_EXITED);
          }

          public void onEDT30() {
              Point loc = textField.getLocationOnScreen();
              textField.setVisible(false);
              robot.mouseMove(loc.x + textField.getWidth() + 20,
                              loc.y + textField.getHeight() + 20);
              waitForEvent(textField, MouseEvent.MOUSE_DRAGGED);
          }

          public void onEDT40() {
              robot.mouseRelease(InputEvent.BUTTON1_MASK);
              waitForEvent(textField, MouseEvent.MOUSE_RELEASED);
          }
      }

      This relies on SwingTestHelper and other classes which can be found in test/javax/swing/regtesthelpers. On my solaris box running this test produces:

      Exception in thread "Thread-1" sun.awt.SunToolkit$InfiniteLoop
      > >>>> at sun.awt.SunToolkit.realSync(SunToolkit.java:1424)
      > >>>> at SwingTestHelper.controlLoop(SwingTestHelper.java:513)
      > >>>> at SwingTestHelper.access$600(SwingTestHelper.java:173)
      > >>>> at SwingTestHelper$4.run(SwingTestHelper.java:470)
      > >>>> at java.lang.Thread.run(Thread.java:619)

            bagiras Oleg Pekhovskiy (Inactive)
            svioletsunw Scott Violet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: