<Swing Dev> <Swing-dev> [9] Review fix for JDK-8020039 : SynthTableHeaderUI refers to possibly null parameter in cell renderer
Rajeev Chamyal
rajeev.chamyal at oracle.com
Mon Feb 15 12:08:34 UTC 2016
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; 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/20160215/8dd30adc/attachment.html>
More information about the swing-dev
mailing list