craigmcc    02/03/15 20:11:04

  Modified:    beanutils/src/java/org/apache/commons/beanutils
                        PropertyUtils.java
  Log:
  In copyProperties(), skip write-only properties on the origin bean without
  throwing an exception.
  
  PR: Bugzilla #6217 (reported against Struts)
  Submitted by: Arnaud Heritier <aheritier at sopragroup.com>
  
  Revision  Changes    Path
  1.22      +14 -4     
jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java
  
  Index: PropertyUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- PropertyUtils.java        23 Jan 2002 22:35:58 -0000      1.21
  +++ PropertyUtils.java        16 Mar 2002 04:11:04 -0000      1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
 1.21 2002/01/23 22:35:58 sanders Exp $
  - * $Revision: 1.21 $
  - * $Date: 2002/01/23 22:35:58 $
  + * $Header: 
/home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
 1.22 2002/03/16 04:11:04 craigmcc Exp $
  + * $Revision: 1.22 $
  + * $Date: 2002/03/16 04:11:04 $
    *
    * ====================================================================
    *
  @@ -131,7 +131,7 @@
    * @author Gregor Raýman
    * @author Jan Sorensen
    * @author Scott Sanders
  - * @version $Revision: 1.21 $ $Date: 2002/01/23 22:35:58 $
  + * @version $Revision: 1.22 $ $Date: 2002/03/16 04:11:04 $
    */
   
   public class PropertyUtils {
  @@ -256,6 +256,16 @@
   
           PropertyDescriptor origDescriptors[] = getPropertyDescriptors(orig);
           for (int i = 0; i < origDescriptors.length; i++) {
  +            Method readMethod = origDescriptors[i].getReadMethod();
  +            if ((readMethod == null) &&
  +                (origDescriptors[i] instanceof IndexedPropertyDescriptor)) {
  +                readMethod =
  +                    ((IndexedPropertyDescriptor) origDescriptors[i]).
  +                    getIndexedReadMethod();
  +            }
  +            if (readMethod == null) {
  +                continue; // This is a write-only property
  +            }
               String name = origDescriptors[i].getName();
               if (getPropertyDescriptor(dest, name) != null) {
                   Object value = getSimpleProperty(orig, name);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to