Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8238936

The crash in XRobotPeer when the custom GraphicsDevice is used

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11, 15
    • Fix Version/s: 15
    • Component/s: client-libs
    • Subcomponent:
    • Resolved In Build:
      b16
    • CPU:
      generic
    • OS:
      linux

      Description

      The code below crashes on Unix:

      import java.awt.GraphicsConfiguration;
      import java.awt.GraphicsDevice;
      import java.awt.Robot;

      public class CrashRobot {

           public static void main(final String[] args) throws Exception {
               final GraphicsDevice gd = new GraphicsDevice() {
                   @Override
                   public int getType() {
                       return TYPE_RASTER_SCREEN;
                   }

                   @Override
                   public String getIDstring() {
                       return "Custom screen device";
                   }

                   @Override
                   public GraphicsConfiguration[] getConfigurations() {
                       return new GraphicsConfiguration[0];
                   }

                   @Override
                   public GraphicsConfiguration getDefaultConfiguration() {
                       return null;
                   }
               };

               final Robot r = new Robot(gd);
               r.getPixelColor(0, 0);
           }
      }

      On macOS the java.lang.ClassCastException is occured.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                serb Sergey Bylokhov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: