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

Gobal beanInfo is not package specific

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description



      Name: wm7046 Date: 06/12/97


      I just found out, much to my chagrin, that the BeanInfo spec has a serious flaw. The spec allows for a global definition of a BeanInfo to exist somewhere in a searchpath settable using the
      Introspector.setBeanInfoSearchpath() method. By default, the
      searchpath is set to sun.beans.infos. JavaSoft ships one beanInfo class called ComponentBeanInfo. It so happens that I have a base class in its own package called Component which does not have its own beanInfo class. I was counting on the default introspection to give me info about subclasses of this class but started getting some extremely strange results. Can
      the problem of global beanInfo not being package specific be fixed? The same thing appears to happen with property editors.

      import java.lang.reflect.*;
      import java.beans.*;


      class Component
      {
        int someProperty = 1;

        public int getSomeProperty() { return someProperty; }
        public void setSomeProperty( int s ) { someProperty = s; }
      }

      public class Bug
      {
        public static void main(String[] args)
          {
            try {
              Component aComponent = new Component();
              System.out.println( "aComponent class = " +
                                  aComponent.getClass() );
              BeanInfo beanInfo = Introspector.getBeanInfo( aComponent.getClass() );
              System.out.println( "BeanInfo class = " +
                                  beanInfo.getBeanDescriptor().getBeanClass() );

              PropertyDescriptor pds[] = beanInfo.getPropertyDescriptors();
              for ( int i = 0; i < pds.length; i++ ) {
                System.out.println("prop = " + pds[i].getName() );
              }
            }
            catch (Exception e) {
              System.out.println("Exception caught: " + e );
            }
          }
      }

      D:\java_bugs>java bug
      aComponent class = class Component
      BeanInfo class = class Component
      prop = enabled
      prop = foreground
      prop = visible
      prop = background
      prop = font
      prop = name
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            ghamiltosunw Graham Hamilton (Inactive)
            Reporter:
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: