-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 04/27/98
The specification for methods
addPropertyChangeListener(String, PropertChangeListener pcl) and
addVetoableChangeListener(String, VetoableChangeListener vcl) doesn't specify
behavior for null 'pcl' and 'vcl'.
Currently methods don't check params for null, so thereafter
methods firePropertyChange and fireVatoableChange respectively
throw undocumented NullPointerException.
Here is what doc says:
--------------------------------------------------
public void addPropertyChangeListener(String name,
PropertyChangeListener pcl)
add a property change listener
Implements:
addPropertyChangeListener in interface BeanContextChild
public void addVetoableChangeListener(String name,
VetoableChangeListener vcl)
add a vetoable change listener
Implements:
addVetoableChangeListener in interface BeanContextChild
Here is the test demonstrating the bug
-----------------Test.java------------------------
import java.beans.beancontext.*;
public class Test {
public static void main(String[] args) {
BeanContextChildSupport bccs = new BeanContextChildSupport();
bccs.addPropertyChangeListener("string",null);
try {
bccs.firePropertyChange("string", new Integer(0), new Integer(1));
} catch (NullPointerException e) {
System.out.println(e);
}
}
}
---------Output from the test---------------------
java.lang.NullPointerException
--------------------------------------------------
======================================================================