8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1
authorazvegint
Mon, 16 Jan 2017 16:37:47 +0300
changeset 43229 e5d389380a23
parent 43228 cca4e204cc6c
child 43230 f139e452dd55
8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1 Reviewed-by: serb
jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Thu Jan 12 13:34:58 2017 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Mon Jan 16 16:37:47 2017 +0300
@@ -27,7 +27,7 @@
 import java.awt.*;
 import java.awt.peer.*;
 import java.security.AccessController;
-import java.security.PrivilegedAction;
+import sun.security.action.GetPropertyAction;
 
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
@@ -40,11 +40,11 @@
     static final boolean tryGtk;
     static {
         loadNativeLibraries();
-        tryGtk = AccessController.doPrivileged((PrivilegedAction<Boolean>)()
-                -> Boolean.getBoolean("awt.robot.gtk"));
+        tryGtk = Boolean.parseBoolean(
+                            AccessController.doPrivileged(
+                                    new GetPropertyAction("awt.robot.gtk", "true")
+                            ));
     }
-
-    private static boolean isGtkSupported =  false;
     private static volatile boolean useGtk;
     private X11GraphicsConfig   xgc = null;