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

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Fri Sep 7 10:57:47 UTC 2018


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/20180907/f4c7c7a3/attachment.html>


More information about the swing-dev mailing list