test/jdk/java/awt/TrayIcon/CtorTest/CtorTest.java
author serb
Wed, 21 Feb 2018 12:49:00 -0800
changeset 49096 eaef201ec301
parent 47216 71c04702a3d5
permissions -rw-r--r--
8198333: ProblemList should be updated for headless mode Reviewed-by: psadhukhan, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3233
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3233
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
3233
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     4
 *
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     8
 *
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    13
 * accompanied this code).
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    14
 *
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3233
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3233
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3233
diff changeset
    21
 * questions.
3233
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    22
 */
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    23
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    24
/*
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    25
  @test
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    26
  @bug 6759726
49096
eaef201ec301 8198333: ProblemList should be updated for headless mode
serb
parents: 47216
diff changeset
    27
  @key headful
3233
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    28
  @summary TrayIcon constructor throws NPE instead of documented IAE
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    29
  @author Dmitry Cherepanov area=awt.tray
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    30
  @run main CtorTest
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    31
*/
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    32
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    33
/**
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    34
 * CtorTest.java
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    35
 *
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    36
 * summary:  TrayIcon ctor throws IAE if image is null
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    37
 */
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    38
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    39
import java.awt.*;
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    40
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    41
public class CtorTest
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    42
{
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    43
    public static void main(String []s)
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    44
    {
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    45
        boolean isSupported = SystemTray.isSupported();
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    46
        if (isSupported) {
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    47
            try {
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    48
                TrayIcon tray = new TrayIcon(null);
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    49
            } catch(IllegalArgumentException e) {
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    50
                // ctor should throw IAE
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    51
            }
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    52
        }
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    53
    }
abdab1f90b46 6759726: TrayIcon constructor throws NPE instead of documented IAE
dcherepanov
parents:
diff changeset
    54
}