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

PropertyDescriptor.getName() alters case of property

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs
    • x86
    • windows_2000



      Name: gm110360 Date: 11/19/2003


      FULL PRODUCT VERSION :

      Microsoft Windows 2000 [Version 5.00.2195]
      (C) Copyright 1985-2000 Microsoft Corp.

      e:\apache>java -version
      java version "1.4.0_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_03-b04)
      Java HotSpot(TM) Client VM (build 1.4.0_03-b04, mixed mode)

      e:\apache>

      FULL OPERATING SYSTEM VERSION : Windows 2000


      A DESCRIPTION OF THE PROBLEM :

      The "getName()" method on the PropertyDescriptor class says
      it provides the name of the property. However, it is
      altering the case of the first letter of the property name,
      for instance, if the name of the field in the bean
      is "MyFoo" it returns "myFoo".



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. create a bean with properties which have upper case names
      2. introspect the bean using PropertyDescriptors
      3. get the name of the property with the "getName" method
      4. The case is different than the actual name.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expected the accurate name, case-preserved. I got a case-
      altered name.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error messages.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.beans.*;

      public class test {
      int MyFoo;

      public int getMyFoo() {
      return MyFoo;
      }

      public void setMyFoo(int MyFoo) {
      this.MyFoo = MyFoo;
      }

      static public void main(String args[]) {
      test t = new test();
      try {
      BeanInfo bi = Introspector.getBeanInfo(t.getClass());
      PropertyDescriptor[] pd = bi.getPropertyDescriptors();

      for (int i = 0; i < pd.length; i++) {
      String name = pd[i].getName();
      System.out.println("getName() = " + name);
      }
      } catch (IntrospectionException e) {
      System.err.println("Introspect error: " + e.getMessage
      ());
      }
      }
      }

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

      CUSTOMER WORKAROUND :
      I have been looking for a work-around. Please tell me if
      you know of one.
      (Incident Review ID: 179424)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: