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

Clemens Eisserer linuxhippy at gmail.com
Sat Apr 13 10:19:17 UTC 2013


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();

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
system seems to be dead.

Please let me know what you think.

Regards, Clemens



More information about the swing-dev mailing list