Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4382916
Votes 1
Synopsis DefaultPopupFactory causes NullPointerException if parent is null
Category java:classes_swing
Reported Against 1.3
Release Fixed
State 11-Closed, duplicate of 4303635, bug
Priority: 3-Medium
Related Bugs 4303635
Submit Date 25-OCT-2000
Description




25 Oct 2000,   xxxxx@xxxxx   -- 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) 
======================================================================
Work Around
N/A
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.
  xxxxx@xxxxx   2000-11-27
Comments
  
  Include a link with my name & email   

Submitted On 13-NOV-2000
lindberger
It would be a whole lot easier to work around this type of bugs
if properties like popupFactory of ToolTipManager could be set.
After all, there is an interface PopupFactory but the reference
to it is private in ToolTipManger and set to a DefaultPopupFactory
during construction. If the "default" is going to be that final, it had better 
not contain any bugs ;-) And by the way, shouldn't hide() be replaced by
setVisible(false)?


Submitted On 12-APR-2002
jguistwite
I cannot understand how this bug can be claimed to be fixed 
when the source for DefaultPopupFactory in JDK 1.3.1_03 is 
as follows:
         
        public void hide() {
            Container parent = getParent();
            Rectangle r = this.getBounds();
            if(parent != null)
                parent.remove(this);
            parent.repaint(r.x,r.y,r.width,r.height);
        }



PLEASE NOTE: JDK6 is formerly known as Project Mustang