<AWT Dev> [14] Review Request: 8233657 Intermittent NPE in Component.validate()

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Nov 7 21:02:59 UTC 2019

On 11/7/19 6:29 am, Philip Race wrote:
> The fix seems fine but if the app isn't setting null how are we getting null here ?

We get null here only if the test/app sets the null value, in which case this null
value will be ignored and some other font will be used by the peer.

> Frequent hierarchy validation does not in itself explain that to me.

On HiDPI systems the invisible components use some default fonts render_context/metrics
and when the component became visible we change these default values to the actual
HiDPI graphics config ->to a different fonts render_context/metrics -> need to validate

> -phil.
> On 11/6/19, 2:48 PM, Sergey Bylokhov wrote:
>> Hello.
>> Please review the fix for JDK 14.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8233657
>> Fix: http://cr.openjdk.java.net/~serb/8233657/webrev.00
>> During testsprint I have analyzed some intermittent failures of our tests and
>> found some intermittent NPE. The root cause is the calling of Component.validate()
>> if the null font is used. The bug reproduced mostly on HiDPI systems where we
>> validate the hierarchy of components more often.
>> The validate method is aupdated to use the same logic as setFont(), where null value
>> is ignored and never passed to the peer.
>> Actually the fix is simpler than the tests problem listing due to product bug.

Best regards, Sergey.

More information about the awt-dev mailing list