commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject cvs commit: jakarta-commons/digester/src/java/org/apache/commons/digester SetPropertiesRule.java
Date Mon, 27 Sep 2004 06:20:38 GMT
skitching    2004/09/26 23:20:38

  Modified:    digester/src/java/org/apache/commons/digester
                        SetPropertiesRule.java
  Log:
  Added some comments about the use of PropertyUtils to check for
  xml attributes with no corresponding bean setter methods.
  
  Revision  Changes    Path
  1.21      +20 -1     jakarta-commons/digester/src/java/org/apache/commons/digester/SetPropertiesRule.java
  
  Index: SetPropertiesRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/SetPropertiesRule.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SetPropertiesRule.java	20 Sep 2004 21:59:23 -0000	1.20
  +++ SetPropertiesRule.java	27 Sep 2004 06:20:38 -0000	1.21
  @@ -206,6 +206,25 @@
               }
               
               if ((!ignoreMissingProperty) && (name != null)) {
  +                // The BeanUtils.populate method silently ignores items in
  +                // the map (ie xml entities) which have no corresponding
  +                // setter method, so here we check whether each xml attribute
  +                // does have a corresponding property before calling the
  +                // BeanUtils.populate method.
  +                //
  +                // Yes having the test and set as separate steps is ugly and 
  +                // inefficient. But BeanUtils.populate doesn't provide the 
  +                // functionality we need here, and changing the algorithm which 
  +                // determines the appropriate setter method to invoke is 
  +                // considered too risky.
  +                //
  +                // Using two different classes (PropertyUtils vs BeanUtils) to
  +                // do the test and the set is also ugly; the codepaths
  +                // are different which could potentially lead to trouble.
  +                // However the BeanUtils/ProperyUtils code has been carefully 
  +                // compared and the PropertyUtils functionality does appear 
  +                // compatible so we'll accept the risk here.
  +                
                   Object top = digester.peek();
                   boolean test =  PropertyUtils.isWriteable(top, name);
                   if (!test)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message