[OpenJDK 2D-Dev] [9] Review request for 8144703: ClassCastException: sun.font.CompositeFont cannot be cast to PhysicalFont

Alexander Potochkin alexander.potochkin at oracle.com
Tue Jun 28 13:06:04 UTC 2016


Hello Dmitry

Looks good to me!

Thanks
alexp

On 6/17/2016 13:47, dmitry markov wrote:
> Reminder.
>
> Could you review the fix, please?
>
> Thanks in advance,
> Dmitry
> On 10/06/2016 15:07, dmitry markov wrote:
>> Hello,
>>
>> Could you review a fix for jdk9, please?
>>
>>     bug: https://bugs.openjdk.java.net/browse/JDK-8144703
>>     webrev: http://cr.openjdk.java.net/~dmarkov/8144703/webrev.00/
>>
>> Problem description:
>> If an incorrect font file is used, we unable to initialize the font 
>> during CompositeFont.doDeferredInitialisation() invocation and assign 
>> default physical font to the corresponding components entry. Later at 
>> the same method, (i.e. doDeferredInitialisation()) we try to update 
>> this entry one more time, since the name retrieved from the entry and 
>> the name provide by componentNames array are different. The method 
>> SunFontManager.findFont2D() may return a composite font for such 
>> case. As a result we get ClassCastException trying to assign 
>> CompositeFont object to the instance of PhysicalFont.
>>
>> Fix:
>> Surround invocation of SunFontManager.findFont2D() inside 
>> CompositeFont.doDeferredInitialisation() with 'try-catch' to avoid 
>> propagation of ClassCastException.
>>
>> Thanks,
>> Dmitry
>




More information about the 2d-dev mailing list