JDK-6738523 : DefaultCellEditor.getTableCellEditorComponent -> potential stack overflow
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-08-19
  • Updated: 2019-12-17
  • Resolved: 2019-12-17
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_10-rc"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
The DefaultCellEditor.getTableCellEditorComponent source now calls getTableCellRendererComponent if the editorComponent is a JCheckBox, it did not in previous versions.

I'm not sure if calling getTableCellEditorComponent from the getTableCellRendererComponent method is bad practice but I've already got code in custom TableCellRenderers' getTableCellRendererComponent  methods that calls "table.getCellEditor(row, column).getTableCellEditorComponent" to get the checkbox and set the border.  This code now results in a stack overflow.

I can change my code but just upgrading to 1.6.0_10 will result in stack overflows.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JTable and add some cells that result in JCheckBoxes (create a DefaultTableModel with getColumnClass overridden to return boolean)

Create a custom TableCellRenderer and add the following method...
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
            int row, int column)
{
table.getCellEditor(row, column).getTableCellEditorComponent(table, value, isSelected, row, column);
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Better display of JCheckBox within a JTable
ACTUAL -
Stack overflow

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Do not call the getTableCellEditorComponent method from the getTableCellRendererComponent method of a custom TableCellRenderer

Release Regression From : 6u7
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION This is a regression of the fix for 6595814
21-08-2008