test/jdk/java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java
author serb
Mon, 22 Jan 2018 08:00:43 -0800
changeset 48725 9f728dd46c56
parent 47216 71c04702a3d5
permissions -rw-r--r--
6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome Reviewed-by: serb Contributed-by: Michal Vala <mvala@redhat.com>
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
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 5942
diff changeset
     2
 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
5942
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
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 5942
diff changeset
    26
  @key headful
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    27
  @bug 6304473 6727884
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    28
  @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
    29
  @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
    30
  @library ../../regtesthelpers
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    31
  @build Util
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    32
  @run main HandleExceptionOnEDT
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
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    35
import java.awt.*;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    36
import java.awt.event.*;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    37
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    38
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
    39
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    40
public class HandleExceptionOnEDT
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    41
{
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    42
    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
    43
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    44
    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
    45
    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
    46
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    47
    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
    48
    {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    49
        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
    50
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    51
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    52
            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
    53
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    54
                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
    55
                {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    56
                    exceptionHandled = true;
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
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    61
        Frame f = new Frame("F");
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    62
        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
    63
        // set exception handler for EDT
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    64
        f.addWindowListener(new WindowAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    65
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    66
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    67
            public void windowOpened(WindowEvent we)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    68
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    69
                Thread edt = Thread.currentThread();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    70
                edt.setUncaughtExceptionHandler(eh);
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
        });
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    73
        f.setVisible(true);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    74
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    75
        Robot r = Util.createRobot();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    76
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    77
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    78
        // check exception without modal dialog
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    79
        MouseListener exceptionListener = new MouseAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    80
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    81
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    82
            public void mousePressed(MouseEvent me)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    83
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    84
                throw new RuntimeException(EXCEPTION_MESSAGE);
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
        };
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    87
        f.addMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    88
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    89
        exceptionHandled = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    90
        Point fp = f.getLocationOnScreen();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    91
        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
    92
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
    93
        r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    94
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
    95
        r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    96
        f.removeMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    97
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    98
        if (!exceptionHandled)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
    99
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   100
            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
   101
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   102
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   103
        // check exception with modal dialog
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   104
        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
   105
        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
   106
        d.addMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   107
        EventQueue.invokeLater(new Runnable()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   108
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   109
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   110
            public void run()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   111
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   112
                d.setVisible(true);
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
        });
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   115
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   116
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   117
        exceptionHandled = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   118
        Point dp = d.getLocationOnScreen();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   119
        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
   120
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
   121
        r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   122
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
   123
        r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   124
        d.removeMouseListener(exceptionListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   125
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   126
        if (!exceptionHandled)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   127
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   128
            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
   129
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   130
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   131
        // 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
   132
        MouseListener pressedListener = new MouseAdapter()
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   133
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   134
            @Override
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   135
            public void mousePressed(MouseEvent me)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   136
            {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   137
                mousePressed = true;
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
        };
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   140
        f.addMouseListener(pressedListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   141
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   142
        mousePressed = false;
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   143
        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
   144
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
   145
        r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   146
        Util.waitForIdle(r);
48725
9f728dd46c56 6990210: [TEST_BUG] EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java fails on gnome
serb
parents: 47216
diff changeset
   147
        r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
1961
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   148
        Util.waitForIdle(r);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   149
        f.removeMouseListener(pressedListener);
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   150
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   151
        if (mousePressed)
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   152
        {
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   153
            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
   154
        }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   155
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   156
        // test is passed
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   157
        d.dispose();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   158
        f.dispose();
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   159
    }
436a5a828d9f 6727884: Some Uncaught Exceptions are no longer getting sent to the Uncaught Exception Handlers
art
parents:
diff changeset
   160
}