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

Shashidhara Veerabhadraiah shashidhara.veerabhadraiah at oracle.com
Wed Jul 5 05:34:22 UTC 2017


Hi, Here is the updated Webrev with fixes and a new test to test out the fix:

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

Thanks and regards,
Shashi

-----Original Message-----
From: Ajit Ghaisas 
Sent: Tuesday, June 27, 2017 3:22 PM
To: Shashidhara Veerabhadraiah <shashidhara.veerabhadraiah at oracle.com>; swing-dev at openjdk.java.net; Philip Race <philip.race at oracle.com>; Sergey Bylokhov <sergey.bylokhov at oracle.com>
Subject: RE: <Swing Dev> [10] JDK-6919529: NPE from MultiUIDefaults.getUIError

1. You are not checking whether 'tables' is null.

I think the condition check should be in following order :
if (tables != null && tables.length > 0 && tables[0] != null)

2.  Can you please add a regression test for this fix?

Regards,
Ajit

From: Shashidhara Veerabhadraiah 
Sent: Tuesday, June 27, 2017 2:56 PM
To: swing-dev at openjdk.java.net; Philip Race; Sergey Bylokhov
Subject: <Swing Dev> [10] JDK-6919529: NPE from MultiUIDefaults.getUIError

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



More information about the swing-dev mailing list