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

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

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: mgC56079 Date: 09/05/97



      The java.beans.beancontext.BeanContextSupport.getSelectedChildren()
      returns an array filled with nulls if some children selected.

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

       public synchronized Object[] getSelectedChildren()

           Returns:
               an array containing the current (sub)set of children selected
              
      Here is the test demonstrating the bug:

      -----------------Test.java------------------------

      import java.beans.beancontext.BeanContextSupport;

      public class Test {
          public static void main(String[] args) {
              try {
                  BeanContextSupport bcs = new BeanContextSupport();

                  Object[] objects = new Object[1];
                  objects[0] = new Object();
          
                  bcs.addChildren(objects);
                  bcs.selectChildren(objects);

                  Object[] selected = bcs.getSelectedChildren();
                  if ((selected.length==1) && (selected[0] == null)) {
                      System.out.println("getSelectedChildren()[0] == null");
                  }
              
              } catch (Exception e) {
                  System.out.println("Unexpected "+e+" thrown.");
              }
          }
      }


      ---------Output from the test---------------------

      getSelectedChildren()[0] == null

      --------------------------------------------------

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

            lcablesunw Larry Cable (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: