JDK-4649110 : 1.4 REGRESSION: NullPointerException for UIManager.put(Object key, Object value)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-03-07
  • Updated: 2003-04-12
  • Resolved: 2002-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Description

Name: jk109818			Date: 03/07/2002


FULL PRODUCT VERSION :
java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :
Windows 2000 SP2

A DESCRIPTION OF THE PROBLEM :
This technique to get rid of the stippling texture on the
cross-platform UI's toolbars no longer works in the released
version of J2SE 1.4.0 (worked fine in J2SE 1.2 and 1.3:


UIManager.put("ScrollBarUI",
"com.sun.java.swing.plaf.windows.WindowsScrollBarUI");


REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use above code.
2. Watch it get a null pointer exception.


EXPECTED VERSUS ACTUAL BEHAVIOR :
The scrollbar should be the Windows style w/ no stippling.
Instead, you'll get a stack trace from a null pointer
exception.



ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NullPointerException
                 at
com.sun.java.swing.plaf.windows.WindowsScrollBarUI$Grid.getGrid(Windo
                 wsScrollBarUI.java:198)
                 at
com.sun.java.swing.plaf.windows.WindowsScrollBarUI.configureScrollBar
                 Colors(WindowsScrollBarUI.java:52)
                 at
javax.swing.plaf.basic.BasicScrollBarUI.installDefaults(BasicScrollBa
                 rUI.java:160)
                 at
javax.swing.plaf.basic.BasicScrollBarUI.installUI(BasicScrollBarUI.ja
                 va:102)
                 at javax.swing.JComponent.setUI(JComponent.java:445)
                 at javax.swing.JScrollBar.setUI(JScrollBar.java:185)
                 at javax.swing.JScrollBar.updateUI(JScrollBar.java:205)
                 at javax.swing.JScrollBar.<init>(JScrollBar.java:139)
                 at javax.swing.JScrollBar.<init>(JScrollBar.java:154)
                 at
javax.swing.JScrollPane$ScrollBar.<init>(JScrollPane.java:674)
                 at
javax.swing.JScrollPane.createVerticalScrollBar(JScrollPane.java:819)

                 at javax.swing.JScrollPane.<init>(JScrollPane.java:261)
                 at javax.swing.JScrollPane.<init>(JScrollPane.java:313)
                 at
FileSystemTreeScrollPane.<init>(FileSystemTreeScrollPane.java)
                 at
FileSystemTreeScrollPane.<init>(FileSystemTreeScrollPane.java)
                 at BrowserSplitPane.<init>(BrowserSplitPane.java)
                 at TriSplitPane.<init>(TriSplitPane.java)
                 at TransMedia.init(TransMedia.java)
                 at TransMedia.main(TransMedia.java)

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
UIManager.put("ScrollBarUI",
                 "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
None.
Comment out this line of code and your program will run
under JDK1.4.0.

Release Regression From : 1.3.1
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 139822) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis mantis-b02 FIXED IN: mantis mantis-b02 INTEGRATED IN: mantis mantis-b02
14-06-2004

EVALUATION WindowsScrollBarUI is assuming the colors from the defaults table will be non-null. ###@###.### 2002-05-17 While you should not assume you can use one UI class with another class, I am fixing this because it is such a simple change. ###@###.### 2002-07-18
17-05-2002