jdk/test/java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java
author mfang
Wed, 17 Aug 2011 14:18:26 -0700
changeset 10294 8fcdae2a7ec7
parent 5942 287c421fb9b2
child 39056 d99e63b6d962
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5942
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     1
/*
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     4
 *
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     7
 * published by the Free Software Foundation.
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     8
 *
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    13
 * accompanied this code).
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    14
 *
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    18
 *
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    21
 * questions.
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    22
 */
287c421fb9b2 6424157: java.awt.EventQueue push/pop might cause threading issues
art
parents: 1961
diff changeset
    23
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    24
/*
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    25
  @test
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    26
  @bug 6304473 6727884
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    27
  @summary Tests that an exception on EDT is handled with ThreadGroup.uncaughtException()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    28
  @author artem.ananiev: area=awt.eventdispatching
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    29
  @library ../../regtesthelpers
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    30
  @build Util
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    31
  @run main HandleExceptionOnEDT
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    32
*/
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    33
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    34
import java.awt.*;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    35
import java.awt.event.*;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    36
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    37
import test.java.awt.regtesthelpers.Util;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    38
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    39
public class HandleExceptionOnEDT
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    40
{
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    41
    private final static String EXCEPTION_MESSAGE = "A1234567890";
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    42
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    43
    private static volatile boolean exceptionHandled = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    44
    private static volatile boolean mousePressed = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    45
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    46
    public static void main(String[] args)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    47
    {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    48
        final Thread.UncaughtExceptionHandler eh = new Thread.UncaughtExceptionHandler()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    49
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    50
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    51
            public void uncaughtException(Thread t, Throwable e)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    52
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    53
                if (e.getMessage().equals(EXCEPTION_MESSAGE))
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    54
                {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    55
                    exceptionHandled = true;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    56
                }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    57
            }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    58
        };
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    59
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    60
        Frame f = new Frame("F");
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    61
        f.setBounds(100, 100, 400, 300);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    62
        // set exception handler for EDT
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    63
        f.addWindowListener(new WindowAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    64
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    65
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    66
            public void windowOpened(WindowEvent we)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    67
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    68
                Thread edt = Thread.currentThread();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    69
                edt.setUncaughtExceptionHandler(eh);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    70
            }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    71
        });
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    72
        f.setVisible(true);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    73
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    74
        Robot r = Util.createRobot();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    75
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    76
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    77
        // check exception without modal dialog
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    78
        MouseListener exceptionListener = new MouseAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    79
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    80
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    81
            public void mousePressed(MouseEvent me)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    82
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    83
                throw new RuntimeException(EXCEPTION_MESSAGE);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    84
            }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    85
        };
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    86
        f.addMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    87
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    88
        exceptionHandled = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    89
        Point fp = f.getLocationOnScreen();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    90
        r.mouseMove(fp.x + f.getWidth() / 2, fp.y + f.getHeight() / 2);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    91
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    92
        r.mousePress(InputEvent.BUTTON1_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    93
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    94
        r.mouseRelease(InputEvent.BUTTON2_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    95
        f.removeMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    96
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    97
        if (!exceptionHandled)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    98
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    99
            throw new RuntimeException("Test FAILED: exception is not handled for frame");
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   100
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   101
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   102
        // check exception with modal dialog
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   103
        final Dialog d = new Dialog(f, "D", true);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   104
        d.setBounds(fp.x + 100, fp.y + 100, 400, 300);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   105
        d.addMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   106
        EventQueue.invokeLater(new Runnable()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   107
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   108
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   109
            public void run()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   110
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   111
                d.setVisible(true);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   112
            }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   113
        });
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   114
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   115
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   116
        exceptionHandled = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   117
        Point dp = d.getLocationOnScreen();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   118
        r.mouseMove(dp.x + d.getWidth() / 2, dp.y + d.getHeight() / 2);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   119
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   120
        r.mousePress(InputEvent.BUTTON1_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   121
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   122
        r.mouseRelease(InputEvent.BUTTON2_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   123
        d.removeMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   124
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   125
        if (!exceptionHandled)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   126
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   127
            throw new RuntimeException("Test FAILED: exception is not handled for modal dialog");
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   128
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   129
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   130
        // check the dialog is still modal
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   131
        MouseListener pressedListener = new MouseAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   132
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   133
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   134
            public void mousePressed(MouseEvent me)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   135
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   136
                mousePressed = true;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   137
            }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   138
        };
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   139
        f.addMouseListener(pressedListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   140
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   141
        mousePressed = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   142
        r.mouseMove(fp.x + 50, fp.y + 50);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   143
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   144
        r.mousePress(InputEvent.BUTTON1_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   145
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   146
        r.mouseRelease(InputEvent.BUTTON1_MASK);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   147
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   148
        f.removeMouseListener(pressedListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   149
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   150
        if (mousePressed)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   151
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   152
            throw new RuntimeException("Test FAILED: modal dialog is not modal or visible after exception");
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   153
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   154
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   155
        // test is passed
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   156
        d.dispose();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   157
        f.dispose();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   158
    }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   159
}