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

Introspector doesn't pick up write methods for IndexedPropertyDescriptor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.4.0
    • client-libs
    • None
    • x86
    • windows_nt

    Description

      Introduced between JDK 1.3 fcs and JDK 1.4beta (before Aug 29, 2000)

      The write method retreieved from the IndexedPropertyDescriptor.getIndexedWriteMethod() seems to be null for most of the IndexedProperties in JTabbedPane. The only properies that seems to have a non null write method is "enabledAt". It could be because the getter method is "is" rather than "get".

      Test code:

      >>>> IndexPropsBug.java

      import java.beans.*;

      public class IndexPropsBug {

          public IndexPropsBug() {

      BeanInfo info;
      PropertyDescriptor[] props;
      String className = "javax.swing.JTabbedPane";

      try {
      info = Introspector.getBeanInfo(Class.forName(className));
      } catch (Exception ex) {
      ex.printStackTrace();
      return;
      }

      props = info.getPropertyDescriptors();
      System.out.println("Number of Property Descriptors: " + props.length);

      // Look for an IndexedPropertyDescriptor and check it for null.
      IndexedPropertyDescriptor iprop;
      int numIndexProps = 0;
      String propName;
      for (int i = 0; i < props.length; i++) {
      propName = props[i].getName();
      if (props[i] instanceof IndexedPropertyDescriptor) {
      iprop = (IndexedPropertyDescriptor)props[i];
      numIndexProps++;
      System.out.print("IndexedProperty " + propName);
      if (iprop.getIndexedWriteMethod() == null) {
      // For JTabbedPane, boundsAt and component are read only props.
      if (!propName.equals("boundsAt") && !propName.equals("component"))
      System.out.print(" is null -- ERROR");

      // should throw an exception for the regression test.
      }
      System.out.print("\n");
      }
      }
      System.out.println("Total # of IndexedProps: " + numIndexProps);
          }

          public static void main(String[] args) {
      new IndexPropsBug();
          }
      }
      <<<< IndexPropsBug.java

      Attachments

        Issue Links

          Activity

            People

              mdavidsosunw Mark Davidson (Inactive)
              mdavidsosunw Mark Davidson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: