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

Introspector returns incorrect BeanInfo class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs
    • generic
    • generic



      Name: stC104175 Date: 06/20/2000


      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      Let's assume I've created a class called "com.mycompany.Component". The
      following code:

      Introspector.getBeanInfo(Class.forName("com.mycompany.Component"));

      will return java.beans.BeanInfo with property descriptors for
      java.awt.Component, i.e. Introspector picks up property descriptors from the
      class in different package, which is wrong.

      The source that I used to reproduce the problem follows:

      import java.beans.*;

      class Test {
      static public void main(String[] args) {
              try {
                      PropertyDescriptor[] properties = Introspector.getBeanInfo
      (com.mycompany.Component.class).getPropertyDescriptors();
                      for (int i = 0; i < properties.length; ++i) {
                             System.out.println(properties[i].getName());
                      }

              }
              catch (IntrospectionException e) {
                      e.printStackTrace();
              }
      }
      }
      (Review ID: 106167)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: