<AWT Dev> [9] Review request for 8173853: IllegalArgumentException in java.awt.image.ReplicateScaleFilter

Sergey Bylokhov sergey.bylokhov at oracle.com
Tue Mar 7 12:54:34 UTC 2017

Ok, Looks fine.

> Hi Sergey,
> I ran JCK tests and didn't observe any problems introduced by the fix.
> Thanks,
> Dmitry
> On 06/03/2017 22:24, Sergey Bylokhov wrote:
>> Ok, But will it be possible to use this custom cursor? For example according to the spec:
>>      * @param hotSpot the X and Y of the large cursor's hot spot; the
>>      *   hotSpot values must be less than the Dimension returned by
>>      *   {@code getBestCursorSize}
>>      * @exception IndexOutOfBoundsException if the hotSpot values are outside
>>      *   the bounds of the cursor
>>     public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
>> I think that this exception will not be thrown when getBestCursorSize () return 0,0 and the hotspot is inside image.w/h but bigger than 0,0. Is it possible that it can cause to fails some jck tests?
>> I do not suggest t change the fix, but can you confirm that this is not a problem.
>>> Hi Sergey,
>>> In my opinion if zero size is returned as a result of getBestCursorsize() invocation, the cursor should have initial size defined by the parameter of its constructor. I am sorry, but it will look very odd especially for end user, if we silently change an original cursor's size to zero even in the environment where custom cursor is not supported. Also I guess the usage of the cursor with zero size may cause some problems like exceptions, etc. in other parts code.
>>> Thanks,
>>> Dmitry
>>> On 02/03/2017 22:08, Sergey Bylokhov wrote:
>>>> Hi, Dmitry.
>>>> I have only the one question: the size 0,0 can be returned if the custom cursors are not supported. I wonder should our CustomCursor have an initial size, of it should have zero size?
>>>>> Hello,
>>>>> Could you review a fix for jdk9, please?
>>>>> 	bug: https://bugs.openjdk.java.net/browse/JDK-8173853
>>>>> 	webrev: http://cr.openjdk.java.net/~dmarkov/8173853/webrev.00/
>>>>> Problem description:
>>>>> Sometimes XQueryBestCursor may return zero-dimension to the code inside XCustomCursor.getBestCursorSize(). As a result the subsequent invocation of CustomCursor constructor will fail with IllegalArgumentException during scaling of the image.
>>>>> Fix:
>>>>> It is necessary to avoid scaling if getBestCursorSize() returns zero-dimension.
>>>>> Thanks,
>>>>> Dmitry

More information about the awt-dev mailing list