United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6579129 REGRESSION:NPE in DefaultTableCellHeaderRenderer in 6u3_b01 due to fix for 6434444
JDK-6579129 : REGRESSION:NPE in DefaultTableCellHeaderRenderer in 6u3_b01 due to fix for 6434444

Details
Type:
Bug
Submit Date:
2007-07-11
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
windows_vista
Sub-Component:
javax.swing
CPU:
x86
Priority:
P1
Resolution:
Fixed
Affected Versions:
6u3
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
NPE thrown in DefaultTableCellHeaderRenderer while lauching the test in 6u3_b01.
It is working fine with 6u2_b05 and jdk7b15. This is a regression due to fix for 6434444.
This is happening on Vista (Ultimate as well as Enterprise) with default theme.

JDK Info:
=========
java version "1.6.0_03-ea"
Java(TM) SE Runtime Environment (build 1.6.0_03-ea-b01)
Java HotSpot(TM) Client VM (build 1.6.0_03-ea-b01, mixed mode, sharing)

A simple JTable with string data and column names set to its headers, throws an NPE(stack trace attached).
Steps to reproduce: 
1)Run the attached test case with 6u3_b01.
THe UI does not come up and the below exception occurs. 
--------------Exception---------------

Z:\disk11\swing\tmp>c:\jdk1.6.0_03\bin\java -Dswing.defaultlaf=com.sun.java.swin
g.plaf.windows.WindowsLookAndFeel TableSamples
java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
        at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1323)
        at TableSamples.main(TableSamples.java:14)
Caused by: java.lang.NullPointerException
        at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(DefaultTableCellHeaderRenderer.java:104)
        at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(WindowsTableHeaderUI.java:108)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderRenderer(BasicTableHeaderUI.java:657)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderHeight(BasicTableHeaderUI.java:692)
        at javax.swing.plaf.basic.BasicTableHeaderUI.createHeaderSize(BasicTableHeaderUI.java:721)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getPreferredSize(BasicTableHeaderUI.java:752)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1632)
        at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:78
)
        at java.awt.Container.preferredSize(Container.java:1616)
        at java.awt.Container.getPreferredSize(Container.java:1601)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
        at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:70
2)
        at java.awt.Container.layout(Container.java:1432)
        at java.awt.Container.doLayout(Container.java:1421)
        at java.awt.Container.validateTree(Container.java:1519)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validate(Container.java:1491)
        at java.awt.Window.show(Window.java:825)
        at java.awt.Component.show(Component.java:1422)
        at java.awt.Component.setVisible(Component.java:1375)
        at java.awt.Window.setVisible(Window.java:806)
        at TableSamples.createAndShowGUI(TableSamples.java:45)
        at TableSamples.<init>(TableSamples.java:29)
        at TableSamples$1.run(TableSamples.java:18)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(DefaultTableCellHeaderRenderer.java:104)
        at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(WindowsTableHeaderUI.java:108)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderRenderer(BasicTableHeaderUI.java:657)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderHeight(BasicTableHeaderUI.java:692)
        at javax.swing.plaf.basic.BasicTableHeaderUI.createHeaderSize(BasicTableHeaderUI.java:721)
        at javax.swing.plaf.basic.BasicTableHeaderUI.getPreferredSize(BasicTableHeaderUI.java:752)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1632)
        at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:78)
        at java.awt.Container.preferredSize(Container.java:1616)
        at java.awt.Container.getPreferredSize(Container.java:1601)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
        at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:702)
        at java.awt.Container.layout(Container.java:1432)
        at java.awt.Container.doLayout(Container.java:1421)
        at java.awt.Container.validateTree(Container.java:1519)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validateTree(Container.java:1526)
        at java.awt.Container.validate(Container.java:1491)
        at java.awt.Window.dispatchEventImpl(Window.java:2438)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

--------------Exception---------------

If I uncomment the line table.setAutoCreateRowSorter(true) , the exception does not occur any more.

                                    

Comments
WORK AROUND

Setting the setCreateRowSorter property to true and you do not see the exception.
                                     
2007-07-11
EVALUATION

DefaultTableCellHeaderRenderer.getColumnSortOrder needs to return null if rowSorter is not defined
                                     
2007-07-17



Hardware and Software, Engineered to Work Together