JDK-4909150 : WindowsTreeUI can cause NullPointerException occasionally
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-08-19
  • Updated: 2013-09-06
  • Resolved: 2012-06-06
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.
JDK 7 JDK 8
7u2Fixed 8 b01Fixed
Related Reports
Relates :  
Relates :  
Description

Name: jk109818			Date: 08/19/2003


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

FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
WindowsTreeUI.ensureRowsAreVisible remembers to check for getPathBounds returning null in the 1st half of the method, but forgets to check for it in the 2nd half of the method.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just looking at the WindowsTreeUI.ensureRowsAreVisible shows why this problem is occuring, simply checking for testRect == null like the same method already does with scrollBounds will fix the problem, hence I am not providing a test case.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exception
ACTUAL -
NullPointerException

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
	at com.sun.java.swing.plaf.windows.WindowsTreeUI.ensureRowsAreVisible(WindowsTreeUI.java:91)
	at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2099)
	at javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2082)
	at javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2036)
	at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2831)
	at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mouseReleased(BasicTreeUI.java:2864)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
	at java.awt.Component.processMouseEvent(Component.java:5100)
	at java.awt.Component.processEvent(Component.java:4897)
	at java.awt.Container.processEvent(Container.java:1569)
	at java.awt.Component.dispatchEventImpl(Component.java:3615)
	at java.awt.Container.dispatchEventImpl(Container.java:1627)
	at java.awt.Component.dispatchEvent(Component.java:3477)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
	at java.awt.Container.dispatchEventImpl(Container.java:1613)
	at java.awt.Window.dispatchEventImpl(Window.java:1606)
	at java.awt.Component.dispatchEvent(Component.java:3477)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

REPRODUCIBILITY :
This bug can be reproduced occasionally.

---------- BEGIN SOURCE ----------
See steps to reproduce.
---------- END SOURCE ----------
(Incident Review ID: 191525) 
======================================================================

Comments
EVALUATION Name: apR10133 Date: 09/04/2003 This changes have a sense. We need to do this. ###@###.### ====================================================================== Name: apR10133 Date: 09/16/2003 The WindowsTreeUI.ensureRowsAreVisible is called with a valid rows only. ###@###.### ======================================================================
24-08-2004