Hello Clemens,
Could you send a code snippet from your application that reproduces
the NPE?
I think we should investigate first why the JTable.prepareRenderer()
returns null in this case.
Thanks,
Alexandr.
On 4/18/2013 9:37 AM, Miguel Muñoz wrote:
JTable.prepareRenderer() should never return null. There's nothing in
the API to suggest that null is a valid return value. I have found
(and reported) at least one bug in Nimbus where it returns a null
renderer when the column class is Icon. I think that's fixed, but I
wouldn't be surprised if there are others.
— Miguel Muñoz
On Apr 16, 2013, at 7:55 AM, Alexander Scherbatiy wrote:
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/
<http://cr.openjdk.java.net/%7Eceisserer/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
-------------------------------------------
Miguel Muñoz
[email protected] <mailto:[email protected]>
323/225-7285
-------------------------------------------
/The Sun, with all those planets revolving around it and dependent on
it, can still ripen a vine of grapes like it had nothing else to do in
the world./
-- Galileo
-------------------------------------------
/
/
/There are seven sins in the world./
/ Wealth without work./
///Pleasure without conscience./
///Knowledge without character./
///Commerce without morality./
///Science without humanity./
///Worship without sacrifice./
///Politics without principle.///
/
/
-- Mohandas Gandhi
-------------------------------------------
/If tyranny and oppression come to this land, it will come in the
guise of fighting a foreign enemy./
-- James Madison