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

spec for ctor java.beans.beancontext.BeanContextMembershipEvent unclear

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.5



      Name: sdC67446 Date: 04/27/98


      The spec for ctor
      java.beans.beancontext.BeanContextMembershipEvent(BeanContext bc,
      Object[] changes) does not specify behavior if 'changes' == null.
      Currently ctor doesn't check 'changes' for null.
      After that method size() throws unexpected NullPointerException.

      More acceptible behavior here is to throw NullPointerException
      in ctor unless otherwise specified.
      --------------Here is what doc says:--------------

      BeanContextMembershipEvent

      public BeanContextMembershipEvent(BeanContext bc,
                                        Object[] changes)

             Contruct a BeanContextMembershipEvent
             Parameters:
                    bc - The BeanContext source
                    changes - The Children effected

      -----Here is the test demonstrating the bug:------

      import java.beans.beancontext.*;

      public class Test extends BeanContextMembershipEvent {

          public Test(BeanContext bc,Object[] objects) {
              super(bc,objects);
          }

          public static void main(String[] args) {

              BeanContextSupport bcs = new BeanContextSupport();
              Test bcme = new Test(bcs,null);

              try {
                  System.out.println(bcme.size());
              } catch (Exception e) {
                  System.out.println("-"+e);
              }
          }
      }
      -----Here is output from test:--------------------
      -java.lang.NullPointerException
      --------------------------------------------------
      ======================================================================

            jkoenigsunw Janet Koenig (Inactive)
            sdmitriesunw Sergei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: