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

spec for ctor java.beans.beancontext.BeanContextMembershipEvent unclear

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: