Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4132697

spec for method java.beans.beancontext.BeanContextChildSupport unclear

XMLWordPrintable

    • 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
      --------------------------------------------------
      ======================================================================

            lcablesunw Larry Cable (Inactive)
            sdmitriesunw Sergei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: