<Swing Dev> [10] JDK-6919529: NPE from MultiUIDefaults.getUIError

Shashidhara Veerabhadraiah shashidhara.veerabhadraiah at oracle.com
Tue Jun 27 09:25:37 UTC 2017


Hi All,

       Please review the fix for the JDK-6919529 where there is a NPE at MultiUIDefaults.

 

Issue: NPE at MultiUIDefaults overridden method of getUIError(String) which does not initializes the tables[0] object. There are 2 ways to initialize the tables[0] object either via the default constructor or parametric constructor. Since the method that is being overridden has the signature of getUIError(String), there is no way it can accept the UIDefault instance as an input but the code assumes that the default 'UIDefaults' instance be the one that is local to the MultiUIDefaults class and assumes that the object is fully constructed and hence defaults to the tables[] usage as the default behavior to get the UI error.

 

Resolution: The default assumption that the class instance is fully constructed is checked for it's completeness before it's usage. All the other methods including overridden methods checks the tables[] is null or not whereas only the getUIError() methods does not. This is fixed in this fix.

 

Test outputs: No NPE at the end of this fix.

 

Bug: https://bugs.openjdk.java.net/browse/JDK-6919529

Webrev: http://cr.openjdk.java.net/~pkbalakr/shashi/6919529/webrev_00/

 

Thanks and regards,

Shashi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20170627/83b54af9/attachment.html>


More information about the swing-dev mailing list