United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 5096948 1.5.0 Regression: NPE when switching from Metal L&F with JComboBox
5096948 : 1.5.0 Regression: NPE when switching from Metal L&F with JComboBox

Details
Type:
Bug
Submit Date:
2004-09-03
Status:
Resolved
Updated Date:
2004-10-25
Project Name:
JDK
Resolved Date:
2004-09-22
Component:
client-libs
OS:
windows_nt
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0u1

Related Reports
Backport:
Relates:

Sub Tasks

Description
Bug 4864304 made various performance enhancements to Swing. One of the things it did was to allow null for the horizontal scroll bar of a JScrollPane. It then changed BasicComboPopup to set the horizontal scrollbar of the scrollpane to null.

After this fix, when using a JComboBox to switch the look and feel from Metal, a NullPointerException is thrown from MetalScrollPaneUI.uninstallUI (which doesn't check for null). A test case is attached (JSliderTest.java). Run it, and switch to another L&F.

Note: I have another test case which does something similar (ListTest.java), but it isn't affected. I don't know why - could this be timing related?

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.5.0_01
mustang

FIXED IN:
1.5.0_01
mustang

INTEGRATED IN:
1.5.0_01
mustang


                                     
2004-09-28
EVALUATION

As Shannon says in the description MetalScrollPaneUI's uninstallUI is not checking for a null horizontal/vertical scrollbar and hence the bug.  All other look and feels in all places make sure the horizontal/vertical scrollbars are not null before invoking a method on them.

This bug does not happen with ListTest as the popup (containing the scrollpane) is heavyweight and so not reached by way of SwingUtilities.updateComponentTreeUI that is invoked when you change the look and feel.

With JSliderTest the popup is lightweight, and so part of the frame and reachable by way SU.updateComponentTreeUI.

As part of this change two lines of dead code are being removed from MetalScrollPaneUI.  These were found in searching for all calls to get horizontal/vertical scrollbar.
###@###.### 2004-09-08
                                     
2004-09-08



Hardware and Software, Engineered to Work Together