<Swing Dev> <Swing-dev> [9] Review fix for JDK-8020039 : SynthTableHeaderUI refers to possibly null parameter in cell renderer

Ajit Ghaisas ajit.ghaisas at oracle.com
Mon Feb 15 11:59:57 UTC 2016


Hi,

 

Please review the fix for jdk9,

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

Webrev: http://cr.openjdk.java.net/~arapte/ajit/8020039/webrev.00/

 

 

Issue :

 

    If null is passed as 'table' parameter to  SynthTableHeaderUI::getTableCellRendererComponent() method in  src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java, 

    there is Null Pointer Exception.

   

 

Analysis :

 

   This method already has a null check for 'table' parameter for second access of this parameter in method.

   Whereas the first access of the 'table' parameter lacks this check.

 

 

Fix :

 

   Added null check for the first access of 'table' parameter in SynthTableHeaderUI::getTableCellRendererComponent().

   There is no else block added as the flow continues and passes table to base class method using super. getTableCellRendererComponent().

   The passed parameter is already checked in base class method correctly. Hence, no change is needed in base class.

 

 

Test :

 

   The fix is pretty straight forward. 

   Executed the code snippet given in the bug description. There is no NPE after the fix.

 

Regards,

Ajit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160215/26524a58/attachment.html>


More information about the swing-dev mailing list