8076178: [macosx] Few open swing and awt reg-tests fail after their update to avoid SunToolkit.realSync
authorserb
Mon, 31 Aug 2015 16:56:09 +0300 (2015-08-31)
changeset 32493 31bd2a308840
parent 32492 0808495400e5
child 32494 f67e3c52f31f
8076178: [macosx] Few open swing and awt reg-tests fail after their update to avoid SunToolkit.realSync Reviewed-by: azvegint, yan
jdk/src/java.desktop/share/classes/java/awt/Robot.java
--- a/jdk/src/java.desktop/share/classes/java/awt/Robot.java	Fri Aug 28 14:54:04 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Robot.java	Mon Aug 31 16:56:09 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -33,13 +33,10 @@
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
 import java.awt.peer.RobotPeer;
-import java.lang.reflect.InvocationTargetException;
-import java.security.AccessController;
 
 import sun.awt.AWTPermissions;
 import sun.awt.ComponentFactory;
 import sun.awt.SunToolkit;
-import sun.awt.OSInfo;
 import sun.awt.image.SunWritableRaster;
 
 /**
@@ -558,28 +555,8 @@
      */
     public synchronized void waitForIdle() {
         checkNotDispatchThread();
-
-        try {
-            SunToolkit.flushPendingEvents();
-            // 7185258: realSync() call blocks all DnD tests on OS X
-            if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
-                // post a dummy event to the queue so we know when
-                // all the events before it have been processed
-                EventQueue.invokeAndWait( new Runnable() {
-                                                public void run() {
-                                                    // dummy implementation
-                                                }
-                                            } );
-            } else {
-                ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-            }
-        } catch(InterruptedException ite) {
-            System.err.println("Robot.waitForIdle, non-fatal exception caught:");
-            ite.printStackTrace();
-        } catch(InvocationTargetException ine) {
-            System.err.println("Robot.waitForIdle, non-fatal exception caught:");
-            ine.printStackTrace();
-        }
+        SunToolkit.flushPendingEvents();
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
     }
 
     private void checkNotDispatchThread() {
@@ -593,6 +570,7 @@
      *
      * @return  the string representation.
      */
+    @Override
     public synchronized String toString() {
         String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
         return getClass().getName() + "[ " + params + " ]";