United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6735259 NPE at WindowsComboBoxUI$XPComboBoxButton.getState(WindowsComboBoxUI.java:408)
JDK-6735259 : NPE at WindowsComboBoxUI$XPComboBoxButton.getState(WindowsComboBoxUI.java:408)

Details
Type:
Bug
Submit Date:
2008-08-08
Status:
Resolved
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2008-12-03
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u12 (b02)

Related Reports
Backport:
Backport:

Sub Tasks

Description
When using NetBeans on Win platform with JDK 1.6.0_10, NetBeans users reported they got
following NPE from time to time:

Stacktrace: 
java.lang.NullPointerException
        at com.sun.java.swing.plaf.windows.WindowsComboBoxUI$XPComboBoxButton.getState(WindowsComboBoxUI.java:408)
        at com.sun.java.swing.plaf.windows.XPStyle$GlyphButton.paintComponent(XPStyle.java:717)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)

Unfortunately, issue is random so I can't give you fully reproducible steps. But by looking at NetBeans exception reporter results: http://statistics.netbeans.org/analytics/detail.do?id=11541 we can see that issue is relatively frequent for NetBeans users (already 20 duplicates)

Just suggestion - maybe blind null check would be enough to fix this issue?
I forgot to mention exact JDK build for exception, here it comes:

VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b20
OS: Windows XP, 5.1, x86

Original bug filed in NetBeans IZ: http://www.netbeans.org/issues/show_bug.cgi?id=141853

                                    

Comments
EVALUATION

It looks like a threading problem in the Netbeans code,
but to be on the safe side we can add a null check for the comboBox field
                                     
2008-08-12
EVALUATION

I coundn't make a test case to reproduce this bug,
anyway it worth fixing, because the fix is safe and very anticipated by Netbeans
                                     
2008-11-18



Hardware and Software, Engineered to Work Together