RFR: JDK-8357082 : Stabilize and add debug logs to CopyAreaOOB.java [v2]

Harshitha Onkar honkar at openjdk.org
Thu May 29 00:37:54 UTC 2025


On Wed, 28 May 2025 16:46:17 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   test update: Mouse move to off frame loc
>
> test/jdk/java/awt/Graphics2D/CopyAreaOOB.java line 67:
> 
>> 65:                 Point pt1 = frame.getLocationOnScreen();
>> 66:                 Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
>> 67:                 captureImg = robot.createScreenCapture(rect);
> 
> ~~The captured image includes the frame decorations.~~ I see the frame is not decorated. Yet, the suggestion still applies.
> 
> You can use the location and the size of the canvas itself as the area to capture. For simplicity, save the canvas instance into a static variable.
> 
> I'd avoid hard-coding the width and height like this; constants would be serve the purpose, and if either width or height, or both, changes, all the code automatically updates to use the new values.

Updated

> test/jdk/java/awt/Graphics2D/CopyAreaOOB.java line 147:
> 
>> 145:                 .getLocalGraphicsEnvironment().getDefaultScreenDevice()
>> 146:                 .getDefaultConfiguration();
>> 147:         BufferedImage screenCapture = robot.createScreenCapture(ge.getBounds());
> 
> Using a multi-resolution screen capture could shed some light on failures… If Mac uses a Retina-like display, the captured image is scaled down, which affects the colors on the image.

Updated

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25279#discussion_r2112965381
PR Review Comment: https://git.openjdk.org/jdk/pull/25279#discussion_r2112965528


More information about the client-libs-dev mailing list