<Swing Dev> [12] RFR JDK-8192888: AllSwingComponentsBaselineTest fails with NullPointerException for NimbusLookAndFeel

Krishna Addepalli krishna.addepalli at oracle.com
Mon Sep 10 11:27:35 UTC 2018


Hi Prasanta,

 

Is there any reason why you are explicitly calling SynthLookAndFeel.updateStyle compared to the updateStyle function present in the same class?

 

Thanks,

Krishna

 

From: Prasanta Sadhukhan 
Sent: Friday, September 7, 2018 4:28 PM
To: swing-dev at openjdk.java.net
Subject: <Swing Dev> [12] RFR JDK-8192888: AllSwingComponentsBaselineTest fails with NullPointerException for NimbusLookAndFeel

 

Hi All,

Please review a fix for an issue where obtaining baseline for Button UI in Nimbus L&F results in NPE.
Reason for it is when SynthPanelUI#installDefaults is called during frame instantiation, it calls SynthPanelUI#updateStyle which sets the context AND then the style
    private void updateStyle(JPanel c) {
        SynthContext context = getContext(c, ENABLED);
        style = SynthLookAndFeel.updateStyle(context, this);
    }
Now, SynthContext.getContext is called with style "null" as style is updated after calling getContext.
 So, when getBaseline is called and it tries to invoke context.getStyle().getGraphicsUtils() it causes NPE.

Proposed fix is to updateStyle for this context for this SynthUI object if style is found to be null.

Bug: https://bugs.openjdk.java.net/browse/JDK-8192888
webrev: http://cr.openjdk.java.net/~psadhukhan/8192888/webrev.0/

Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180910/f5c9c2b2/attachment.html>


More information about the swing-dev mailing list