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

java.beans.beancontext.BeanContextSupport.toArray() works wrong

XMLWordPrintable

    • 1.2beta3
    • sparc
    • solaris_2.5
    • Verified



      Name: sdC67446 Date: 09/22/97



      The java.beans.beancontext.BeanContextSupport.toArray() returns an array of children's BCSChildInfo instead of array of children.

      Here is the JDK Specification:
      --------------------------------------------------
       toArray

       public synchronized Object[] toArray()

            Returns:
                  an array of children


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

      public class Test {
        public static void main(String[] args) {
          BeanContextSupport bcs = new BeanContextSupport();
          Object obj = new java.lang.Integer(666);
          bcs.add(obj);
          if (
      (bcs.toArray().length == 1) &&
      (!bcs.toArray()[0].equals(obj))
             ) {
            System.out.println("Abnormal situation.");
          }
        }
      }
      ---------Output from the test---------------------
      Abnomal situation.
      --------------------------------------------------

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

            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: