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

REGRESSION: Introspector loses PropertyDescriptors with no get- and set-Methods

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b78
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp

      Description

      Name: gm110360 Date: 01/28/2004


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      I wrote a BeanInfo class that returns one PropertyDesctiptor that has no get method and no set method. When I do a Introspector.getBeanInfo, I receive all PropertyDesctiptors except this one.

      Since that has worked in JDK131, I compared both sourcefiles of Introspector.java, and I found in 141 a new private Method 'processPropertyDescriptors' which I think is the reason.

      see my comment in the source code

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.beans.*;

      public class IntrospectorBug
      {
          public static void main(String[] args)
          {
              try
              {
                  BeanInfo bi = Introspector.getBeanInfo(IntrospectorBug.class);
                  PropertyDescriptor[] pd = bi.getPropertyDescriptors();
                  //pd should now contain all of my PropertyDescriptors, 'f' and 'x', but in fact it only contains 'f'.
                  for (int i=0; i<pd.length; i++)
                  {
                      String n = pd[i].getName();
                      System.out.println(n);
                  }
              }
              catch (Exception e)
              {
                  e.printStackTrace();
                  System.exit(1);
              }
              System.exit(0);
          }

          private int f=0;
          public void setF(int P_f) { f = P_f; }
          public int getF() { return f; }
      }

      public class IntrospectorBugBeanInfo extends SimpleBeanInfo
      {
          public PropertyDescriptor[] getPropertyDescriptors()
          {
              try
              {
                  PropertyDescriptor fDes = new PropertyDescriptor("f", IntrospectorBug.class, "getF", "setF");
                  PropertyDescriptor xDes = new PropertyDescriptor("x", IntrospectorBug.class, null, null);
                  xDes.setValue("name", "value");
                  return new PropertyDescriptor[] {fDes, xDes};
              }
              catch (IntrospectionException e)
              {
                  e.printStackTrace();
                  return null;
              }
          }
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.3.1
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 182196)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              malenkov Sergey Malenkov (Inactive)
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: