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

failure to return read method from PropertyDescriptor getReadMethod()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P2
    • 6
    • 1.4.2_06
    • client-libs
    • b06
    • sparc
    • solaris_8

    Description

      using jdk 1.4.2_06-b03 or jdk 1.4.2_07-b05 put the ctalog-ejb-client.jar from petstore distribution (either 1.3.1 or 1.3.2) in the classpath. Compile and run TestJDK.java below. On either verions the getAttribute() method will not be shown in the output. With jdk 1.4.2_04-b05 it will.
      java version "1.4.2_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
      [gstevens_j21012]dlsun345:jsp > % echo $CLASSPATH
      /tmp/petstore/1.3.2/catalog-ejb-client.jar:.
      [gstevens_j21012]dlsun345:jsp > % java testjdk/TestJDK
       indexed _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getAttribute(int)
      _readMethod is null
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getCategory()
      _readMethod is public final native java.lang.Class java.lang.Object.getClass()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getDescription()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getImageLocation()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getItemId()
      _readMethod is public double com.sun.j2ee.blueprints.catalog.model.Item.getListCost()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getProductId()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getProductName()
      _readMethod is public double com.sun.j2ee.blueprints.catalog.model.Item.getUnitCost()

      JDK 1.4.2_04
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
      [gstevens_j21012]dlsun345:jsp > % echo $CLASSPATH
      /tmp/petstore/1.3.2/catalog-ejb-client.jar:.
      [gstevens_j21012]dlsun345:jsp > % java testjdk/TestJDK
       indexed _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getAttribute(int)
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getAttribute()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getCategory()
      _readMethod is public final native java.lang.Class java.lang.Object.getClass()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getDescription()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getImageLocation()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getItemId()
      _readMethod is public double com.sun.j2ee.blueprints.catalog.model.Item.getListCost()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getProductId()
      _readMethod is public java.lang.String com.sun.j2ee.blueprints.catalog.model.Item.getProductName()
      _readMethod is public double com.sun.j2ee.blueprints.catalog.model.Item.getUnitCost()

      Test case: TestJDK.java
      package testjdk;
      import java.io.*;
      import java.util.*;
      import java.lang.reflect.*;

      //petstore
      import com.sun.j2ee.blueprints.catalog.model.*;
      //beans
      import java.beans.*;


      public class TestJDK {

          BeanInfo mBeanInfo;
          Map mPropertyByName;
          Map mIndexedPropertyByName;

          public static void main (String[] args) {
              TestJDK testJdk = new TestJDK();
              testJdk.performTest();
          }
          
          public void performTest() {
              Item item = new Item("CATEGORY", "PRODUCTID","PRODUCTNAME", "ITEMID", "IMGLOC", "DESCRIPTION",
                                   "ATTRIBUTE1", "ATTRIBUTE2","ATTRIBUTE3" , "ATTRIBUTE4","ATTRIBUTE5", 1.0d, 10.0d);

              try {
                 mBeanInfo = Introspector.getBeanInfo(item.getClass());
                 mIndexedPropertyByName = new HashMap ();
                 PropertyDescriptor [] pds = mBeanInfo.getPropertyDescriptors ();
                 for (int i = 0; pds != null && i < pds.length; i++) {
      PropertyDescriptor pd = pds [i];
      if (pd instanceof IndexedPropertyDescriptor) {
      IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
                      Method _readMethod = ipd.getIndexedReadMethod();
                      System.out.println(" indexed _readMethod is "+_readMethod);
      }
                    Method _readMethod = pd.getReadMethod();
                    System.out.println("_readMethod is "+_readMethod);
                }
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }

      }
      ###@###.### 2005-03-10 00:06:17 GMT

      Attachments

        Issue Links

          Activity

            People

              kereminsunw Konstantin Eremin (Inactive)
              mmma Marvin Ma (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: