JDK-4382916 : DefaultPopupFactory causes NullPointerException if parent is null
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2000-10-25
  • Updated: 2000-11-27
  • Resolved: 2000-11-27
Related Reports
Duplicate :  
Description

Name: krC82822			Date: 10/25/2000


25 Oct 2000, eval1127@eng -- still present in the 1.3.1 sources (see Comments section)

java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

There is a bug in DefaultPopupFactory.java, method PanelPopup.hide(), line 956.
If parent is null, it throws a NullPointerException.

After this happens once, mouse motion over JTables and JTrees generates
numerous exceptions, and all JTables and Trees become unusable after that (at
least in my application).

DefaultPopupFactory.java:

line#
----
951        public void hide() {
952            Container parent = getParent();
953            Rectangle r = this.getBounds();
954            if(parent != null)
955                parent.remove(this);
956 bug ==>    parent.repaint(r.x,r.y,r.width,r.height);
957        }
(Review ID: 111382) 
======================================================================

Comments
EVALUATION This was fixed with the restructuring of the code as part of 4303635. Refer to it for more details on how the code has changed. scott.violet@eng 2000-11-27
27-11-2000