<Swing Dev> Request for review: NPE when using Nimbus with a TableCellRenderer returning null.

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Tue Apr 16 14:55:41 UTC 2013


On 4/13/2013 2:19 PM, Clemens Eisserer wrote:
> Hi,
>
> When testing a legacy application which was using Metal LnF previously
> with Nimbus I ran into the following problem:
>
>    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
>        at javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:685)
>        at javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)
>        ......
>
> the code in question is:
>
>    TableCellRenderer renderer = table.getCellRenderer(row, column);
>    Component component = table.prepareRenderer(renderer, row, column);
>    Color b = component.getBackground();

     Could you check that returning the null component is the correct 
behavior in this case?
     So there is no the real bug that does not allow to return the right 
component.

>
> I've written a patch to simply check for "component" to be non-null:
> http://cr.openjdk.java.net/~ceisserer/nimbusnpe/
> Unfortunately I don't have a bug number, as the old bug-submission
    There are 2 issues with the NPE in paintCell chain call in JTable:
      6582564 JTable with rowHeader and sorting given NPE when inserting 
a new row
         http://bugs.sun.com/view_bug.do?bug_id=6582564
      6429812 NPE after calling JTable.updateUI() when using a header 
renderer + XP L&F
       http://bugs.sun.com/view_bug.do?bug_id=6429812

    This issue is different so I can create the new one.

    Thanks,
    Alexandr.

> system seems to be dead.
>
> Please let me know what you think.
>
> Regards, Clemens




More information about the swing-dev mailing list