<Swing Dev> [9] Review request for 8170387: JLightweightFrame#syncCopyBuffer() may throw IOOBE

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Nov 29 14:51:47 UTC 2016


Hi, Semyon.
It is a little bit strange that the coordinates which were used to 
create/recreate the image can produce IOOBE when we copy this image 
later. It seems that we have loss of precision when we divide/multiply 
coordinate by the scalefactor. Or probably the reason is that we use the 
different "round" logic when we create the image and when we copy the 
data? I guess that the "round" logic should be the same in both cases, 
but I am not sure which one should be used. It is possible to check it: 
if two JLightweightFrame will be created in a row and placed one after 
another in the container. The correct behavior is that the pixels 
between will not overlap or gaps will not exists(it will be better if 
these components will have a semi-transparent colors).

On 28.11.16 16:50, Semyon Sadetsky wrote:
> Hello,
>
> Please review fix for JDK9:
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8170387
>
> webrev: http://cr.openjdk.java.net/~ssadetsky/8170387/webrev.00/
>
> After the rounding the resulting rectangular area may became bigger than
> the buffer image size and this will cause IOOB error during the
> consequent System#arraycopy() calls. To prevent this error the updated
> area is bounded to the buffer image size.
>
> --Semyon
>


-- 
Best regards, Sergey.



More information about the swing-dev mailing list