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

BC: DOC: unclear spec for beancontext.BeanContextSupport.add/remove

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description

      Name: sdC67446 Date: 06/08/98


      The spec for method
      java.beans.beancontext.BeanContextSupport.add(Object targetChild)
      does not specify behavior if 'targetChild' == null.
      Currently method throws unexpected IllegalArgumentException.
      More convenient behavior here is to throw NullPointerException
      or else it should be figured in spec.
      --------------The doc says:--------------
      public boolean add(Object targetChild)

            Adds/nests a child within this BeanContext

            Invoked as a side effect of java.beans.Beans.instantiate().

            Parameters:
                  targetChildren - The child objects to nest within this BeanContext

      -----Here is the test demonstrating the bug:------
      import java.beans.beancontext.*;
      import java.beans.*;

      public class Test {

          public static void main(String[] args) {

              BeanContextSupport bcs = new BeanContextSupport();
              try {
                  bcs.add(null);
              } catch (Exception e) {
                  System.out.println(e);
              }
          }
      }
      -----Output from test:--------------------
      java.lang.IllegalArgumentException
      --------------------------------------------------
      ======================================================================

      Name: sdC67446 Date: 06/09/98


      Also the spec for method
      java.beans.beancontext.BeanContextSupport.remove(Object targetChild)
      does not specify behavior if 'targetChild' == null.
      Currently remove(null) throws unexpected IllegalArgumentException too.
      ------The doc for remove says:-----------
      public boolean remove(Object targetChild)
            Parameters:
                  targetChildren - The child objects to remove
      -----------------------------------------

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              malenkov Sergey Malenkov (Inactive)
              Reporter:
              sdmitriesunw Sergei Dmitriev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: