-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b26
-
b10
-
x86
-
windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2174114 | 6u14 | Alexander Potochkin | P3 | Closed | Fixed | b04 |
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The new row sorting mechanism for JTable in java 1.6 added code to BasicTableHeaderUI$MouseInputHandler.mouseClicked that assumes the JTableHeader has a link to an JTable.
I have a special case where a table header is rendered without an associated JTable (permitted by the JTableHeader API). Clicking on the table header produces the following exception.
This doesn't happen in Java 1.5
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a table header with no associated JTable to a visible UI and click on the table header.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
nothing
ACTUAL -
NullPointerException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTableHeaderUI$MouseInputHandler.mouseClicked(BasicTableHeaderUI.java:87)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
this.getContentPane().setLayout( new BorderLayout() );
this.setSize( new Dimension(400, 300) );
JTableHeader th = new JTableHeader();
DefaultTableColumnModel dtcm = new DefaultTableColumnModel();
dtcm.addColumn(new TableColumn(0, 100));
th.setColumnModel(dtcm);
th.setPreferredSize(new Dimension(100, 20));
this.getContentPane().add(th);4240)
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Add an unused JTable to the JTableHeader with:
jtableHeader.setJTable(new JTable);
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The new row sorting mechanism for JTable in java 1.6 added code to BasicTableHeaderUI$MouseInputHandler.mouseClicked that assumes the JTableHeader has a link to an JTable.
I have a special case where a table header is rendered without an associated JTable (permitted by the JTableHeader API). Clicking on the table header produces the following exception.
This doesn't happen in Java 1.5
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a table header with no associated JTable to a visible UI and click on the table header.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
nothing
ACTUAL -
NullPointerException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTableHeaderUI$MouseInputHandler.mouseClicked(BasicTableHeaderUI.java:87)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
this.getContentPane().setLayout( new BorderLayout() );
this.setSize( new Dimension(400, 300) );
JTableHeader th = new JTableHeader();
DefaultTableColumnModel dtcm = new DefaultTableColumnModel();
dtcm.addColumn(new TableColumn(0, 100));
th.setColumnModel(dtcm);
th.setPreferredSize(new Dimension(100, 20));
this.getContentPane().add(th);4240)
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Add an unused JTable to the JTableHeader with:
jtableHeader.setJTable(new JTable);
- backported by
-
JDK-2174114 NPE in BasicTableHeaderUI it incorrectly assumes presence of JTable
- Closed
- duplicates
-
JDK-6600661 NullPointerException in BasicTableHeaderUI line 87
- Closed
- relates to
-
JDK-6777378 NullPointerException in XPDefaultRenderer.paint()
- Closed
-
JDK-6776669 NPE in stand-alone JTableHeader
- Closed