You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/09/21 05:39:35 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/util PropertyUtils.java

craigmcc    00/09/20 20:39:34

  Modified:    src/share/org/apache/struts/util PropertyUtils.java
  Log:
  Fix the following bugs:
  
  * PropertyUtils.getPropertyType() incorrectly returned null for an indexed
    property if there was also a non-indexed accessor method.
  
  * PropertyUtils.setIndexedProperty() was missing a return statement if an
    indexed setter was found.
  
  Submitted by: Ate Douma <at...@iwise1.demon.nl>
  
  Revision  Changes    Path
  1.2       +12 -8     jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java
  
  Index: PropertyUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertyUtils.java	2000/08/29 00:42:24	1.1
  +++ PropertyUtils.java	2000/09/21 03:39:34	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.1 2000/08/29 00:42:24 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/29 00:42:24 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.2 2000/09/21 03:39:34 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/09/21 03:39:34 $
    *
    * ====================================================================
    *
  @@ -115,7 +115,7 @@
    * @author Craig R. McClanahan
    * @author Ralph Schaer
    * @author Chris Audley
  - * @version $Revision: 1.1 $ $Date: 2000/08/29 00:42:24 $
  + * @version $Revision: 1.2 $ $Date: 2000/09/21 03:39:34 $
    */
   
   public final class PropertyUtils {
  @@ -476,7 +476,7 @@
   
   
       /**
  -     * Return the Java Class repesenting the property type of the specified
  +     * Return the Java Class representing the property type of the specified
        * property, or <code>null</code> if there is no such property for the
        * specified bean.  This method follows the same name resolution rules
        * used by <code>getPropertyDescriptor()</code>, so if the last element
  @@ -503,10 +503,13 @@
   
   	PropertyDescriptor descriptor =
   	    getPropertyDescriptor(bean, name);
  -	if (descriptor != null)
  +	if (descriptor == null)
  +            return (null);
  +        else if (descriptor instanceof IndexedPropertyDescriptor)
  +            return (((IndexedPropertyDescriptor) descriptor).
  +                    getIndexedPropertyType());
  +        else
   	    return (descriptor.getPropertyType());
  -	else
  -	    return (null);
   
       }
   
  @@ -680,6 +683,7 @@
   		subscript[0] = new Integer(index);
   		subscript[1] = value;
   		writeMethod.invoke(bean, subscript);
  +                return;
   	    }
   	}