<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
Tue Feb 16 09:41:49 UTC 2016


Hi,

 

    Thanks Rajeev for review comments.

     I have checked - windows LAF WindowsTableHeaderUI handles it correctly.

 

     I have added null check for MacOs Aqua.

     Also, I have added a test checking for this null pointer access.

        

    Please review --  http://cr.openjdk.java.net/~arapte/ajit/8020039/webrev.01/ 

 

Regards,

Ajit

 

From: Rajeev Chamyal 
Sent: Monday, February 15, 2016 5:39 PM
To: Ajit Ghaisas; Sergey Bylokhov; Alexander Scherbatiy; swing-dev at openjdk.java.net
Subject: RE: <Swing-dev> [9] Review fix for JDK-8020039 : SynthTableHeaderUI refers to possibly null parameter in cell renderer

 

Hello Ajit,

 

Can you please if similar fix is required for other LAF windows ,Aqua etc.

Please add a regression test case also.

 

Regards,

Rajeev Chamyal

 

From: Ajit Ghaisas 
Sent: 15 February 2016 17:30
To: Rajeev Chamyal; Sergey Bylokhov; Alexander Scherbatiy; HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at openjdk.java.net
Subject: <Swing-dev> [9] Review fix for JDK-8020039 : SynthTableHeaderUI refers to possibly null parameter in cell renderer

 

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/20160216/e6059877/attachment.html>


More information about the swing-dev mailing list