jdk/test/java/awt/Dialog/CrashXCheckJni/CrashXCheckJni.java
author dav
Tue, 25 Mar 2008 15:16:03 +0300
changeset 418 6cc660c20431
child 5506 202f599c92aa
permissions -rw-r--r--
6610244: modal dialog closes with fatal error if -Xcheck:jni is set Summary: obtain WWindowPeer class every time it is required Reviewed-by: art
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
418
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     1
/*
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     4
 *
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     8
 *
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    13
 * accompanied this code).
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    14
 *
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    18
 *
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    21
 * have any questions.
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    22
 */
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    23
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    24
/*
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    25
  @test
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    26
  @bug 6610244
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    27
  @library ../../regtesthelpers
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    28
  @build Util Sysout AbstractTest
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    29
  @summary modal dialog closes with fatal error if -Xcheck:jni is set
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    30
  @author Andrei Dmitriev : area=awt.dialog
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    31
  @run main/othervm -Xcheck:jni CrashXCheckJni
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    32
*/
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    33
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    34
import java.awt.*;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    35
import java.awt.event.*;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    36
import java.util.Timer;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    37
import java.util.TimerTask;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    38
import test.java.awt.regtesthelpers.Util;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    39
import test.java.awt.regtesthelpers.AbstractTest;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    40
import test.java.awt.regtesthelpers.Sysout;
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    41
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    42
public class CrashXCheckJni {
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    43
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    44
    public static void main(String []s)
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    45
    {
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    46
        final Dialog fd = new Dialog(new Frame(), true);
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    47
        Timer t = new Timer();
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    48
        t.schedule(new TimerTask() {
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    49
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    50
            public void run() {
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    51
                System.out.println("RUNNING TASK");
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    52
                fd.setVisible(false);
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    53
                fd.dispose();
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    54
                System.out.println("FINISHING TASK");
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    55
            }
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    56
        }, 3000L);
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    57
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    58
        fd.setVisible(true);
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    59
        t.cancel();
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    60
        Util.waitForIdle(null);
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    61
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    62
        AbstractTest.pass();
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    63
    }
6cc660c20431 6610244: modal dialog closes with fatal error if -Xcheck:jni is set
dav
parents:
diff changeset
    64
}