You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ga...@apache.org on 2004/12/06 07:23:00 UTC

cvs commit: ws-axis/java/src/org/apache/axis/utils BeanPropertyDescriptor.java

gawor       2004/12/05 22:23:00

  Modified:    java/src/org/apache/axis/utils BeanPropertyDescriptor.java
  Log:
  call getRead/WriteMethod once
  
  Revision  Changes    Path
  1.19      +11 -5     ws-axis/java/src/org/apache/axis/utils/BeanPropertyDescriptor.java
  
  Index: BeanPropertyDescriptor.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/utils/BeanPropertyDescriptor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- BeanPropertyDescriptor.java	25 Feb 2004 14:02:48 -0000	1.18
  +++ BeanPropertyDescriptor.java	6 Dec 2004 06:23:00 -0000	1.19
  @@ -21,6 +21,7 @@
   import java.beans.IndexedPropertyDescriptor;
   import java.beans.PropertyDescriptor;
   import java.lang.reflect.Array;
  +import java.lang.reflect.Method;
   import java.lang.reflect.InvocationTargetException;
   
   
  @@ -101,11 +102,14 @@
        */
       public Object get(Object obj) 
           throws InvocationTargetException, IllegalAccessException {
  -        if (myPD.getReadMethod() != null) {
  -            return myPD.getReadMethod().invoke(obj, noArgs);
  +        Method readMethod = myPD.getReadMethod();
  +        if (readMethod != null) {
  +            return readMethod.invoke(obj, noArgs);
  +        } else {
  +            throw new IllegalAccessException(Messages.getMessage("badGetter00"));
           }
  -        throw new IllegalAccessException(Messages.getMessage("badGetter00"));
       }
  +
       /**
        * Set the property value
        * @param obj is the object
  @@ -113,12 +117,14 @@
        */
       public void set(Object obj, Object newValue) 
           throws InvocationTargetException, IllegalAccessException {
  -        if (myPD.getWriteMethod() != null) {
  -            myPD.getWriteMethod().invoke(obj, new Object[] {newValue});
  +        Method writeMethod = myPD.getWriteMethod();
  +        if (writeMethod != null) {
  +            writeMethod.invoke(obj, new Object[] {newValue});
           } else {
               throw new IllegalAccessException(Messages.getMessage("badSetter00"));
           }
       }    
  +
       /** 
        * Get an indexed property
        * @param obj is the object