Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4602

[classlib][beans] Introspector.getBeanInfo(Class) will get wrong BeanInfo when there are same classes in different package.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0M9
    • Classlib
    • None

    Description

      After set more than one path in Introspector.setBeanInfoSearchPath(String[]),
      if there are some classes with the same class name but in different package,
      Introspector.getBeanInfo(Class) will get wrong BeanInfo.

      The getBeanInfo will return the BeanInfo of the first found class regardless with its package.

      ===== Test ======
      public class IntrospectorTest extends TestCase {

      public void testsetBeanInfoSearchPath() throws IntrospectionException {
      Introspector.setBeanInfoSearchPath(new String[]

      { "mockbeans2.info", "mockbeans1.info", }

      );

      BeanInfo beanInfo = Introspector.getBeanInfo(MockSubject.class);
      BeanDescriptor beanDesc = beanInfo.getBeanDescriptor();

      assertEquals(beanDesc.getName(), "mockbeans1");
      assertEquals(beanDesc.getBeanClass(), MockSubject.class);
      }
      }

      Attachments

        1. beanstest.zip
          6 kB
          Sean Qiu
        2. Harmony-4602.diff
          11 kB
          Kevin Zhou

        Activity

          People

            qiuxiaox Sean Qiu
            qiuxiaox Sean Qiu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: