changeset 54160:9fb26c4d8eaa

8217377: javax/swing/JPopupMenu/6583251/bug6583251.java failed with UnsupportedOperation exception Reviewed-by: serb Contributed-by: vikrant.v.agarwal@oracle.com
author akolarkunnu
date Tue, 22 Jan 2019 08:44:33 -0800
parents 997dc1dff075
children f024302abefd
files test/jdk/ProblemList.txt test/jdk/javax/swing/JPopupMenu/6583251/bug6583251.java
diffstat 2 files changed, 26 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/ProblemList.txt	Tue Jan 22 08:35:14 2019 -0800
+++ b/test/jdk/ProblemList.txt	Tue Jan 22 08:44:33 2019 -0800
@@ -808,7 +808,6 @@
 javax/swing/JTextArea/TextViewOOM/TextViewOOM.java 8167355 generic-all
 javax/swing/text/Utilities/8142966/SwingFontMetricsTest.java 8199529 windows-all
 javax/swing/JPopupMenu/8075063/ContextMenuScrollTest.java 202880 linux-all
-javax/swing/JPopupMenu/6583251/bug6583251.java 8213564 linux-all
 javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765  macosx-all,linux-all
 javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
 javax/swing/JButton/4368790/bug4368790.java 8213123 macosx-all
--- a/test/jdk/javax/swing/JPopupMenu/6583251/bug6583251.java	Tue Jan 22 08:35:14 2019 -0800
+++ b/test/jdk/javax/swing/JPopupMenu/6583251/bug6583251.java	Tue Jan 22 08:44:33 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 /*
  * @test
  * @key headful
- * @bug 6583251
+ * @bug 6583251 8217377
  * @summary One more ClassCastException in Swing with TrayIcon
  * @author Alexander Potochkin
  * @run main bug6583251
@@ -57,22 +57,32 @@
     }
 
     public static void main(String[] args) throws Exception {
+        if (SystemTray.isSupported()) {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    createGui();
+                }
+            });
 
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                createGui();
-            }
-        });
+            Robot robot = new Robot();
+            robot.waitForIdle();
+            menu.show(frame, 0, 0);
+            robot.waitForIdle();
 
-        Robot robot = new Robot();
-        robot.waitForIdle();
-        menu.show(frame, 0, 0);
-        robot.waitForIdle();
+            TrayIcon trayIcon = new TrayIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB));
+            MouseEvent ev = new MouseEvent(
+                    new JButton(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false);
+            ev.setSource(trayIcon);
+            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev);
 
-        TrayIcon trayIcon = new TrayIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB));
-        MouseEvent ev = new MouseEvent(
-                new JButton(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false);
-        ev.setSource(trayIcon);
-        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev);
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.dispose();
+                }
+            });
+
+        } else {
+            System.out.println("SystemTray not supported. " + "Skipping the test.");
+        }
     }
 }