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/10/15 05:25:14 UTC

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

craigmcc    00/10/14 20:25:14

  Modified:    src/share/org/apache/struts/util PropertyUtils.java
  Log:
  Make PropertyUtils.copyProperties() skip properties for which the origin
  bean has a getter method but the destination bean has no setter method.
  
  Revision  Changes    Path
  1.5       +9 -5      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PropertyUtils.java	2000/09/23 23:19:33	1.4
  +++ PropertyUtils.java	2000/10/15 03:25:14	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.4 2000/09/23 23:19:33 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/09/23 23:19:33 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/PropertyUtils.java,v 1.5 2000/10/15 03:25:14 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/10/15 03:25:14 $
    *
    * ====================================================================
    *
  @@ -117,7 +117,7 @@
    * @author Craig R. McClanahan
    * @author Ralph Schaer
    * @author Chris Audley
  - * @version $Revision: 1.4 $ $Date: 2000/09/23 23:19:33 $
  + * @version $Revision: 1.5 $ $Date: 2000/10/15 03:25:14 $
    */
   
   public final class PropertyUtils {
  @@ -187,7 +187,11 @@
   	    String name = origDescriptors[i].getName();
   	    if (getPropertyDescriptor(dest, name) != null) {
   		Object value = getSimpleProperty(orig, name);
  -		setSimpleProperty(dest, name, value);
  +                try {
  +                    setSimpleProperty(dest, name, value);
  +                } catch (NoSuchMethodException e) {
  +                    ;   // Skip non-matching property
  +                }
   	    }
   	}