<AWT Dev> [14] Review Request: 8213119 [macos] java/awt/GraphicsDevice/CheckDisplayModes.java fails

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Oct 16 20:02:19 UTC 2019

Please review the fix for JDK 14.

Bug: https://bugs.openjdk.java.net/browse/JDK-8213119
Fix: http://cr.openjdk.java.net/~serb/8213119/webrev.00

Looks like this bug exists for a while, but it depends on the monitor+macOS version.
On my HW I was able to reproduce it on macOS 10.15 only.

The root cause of the problem is the value of the refresh rate of the monitor.
The macOS reports this value as "double", but we store it as "int" on the java side.

When the app sets this "int" value as a refresh rate we compare "double" and "int".
If these values are the same we will successfully set it, but if the "double" has some
fractional part then comparison fails and we throw "IllegalArgumentException".

The fix will cast the value returned by "CGDisplayModeGetRefreshRate" to "int" before

Best regards, Sergey.

More information about the awt-dev mailing list