commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util ValueUtils.java
Date Sat, 12 Oct 2002 20:57:44 GMT
dmitri      2002/10/12 13:57:44

  Modified:    jxpath/src/java/org/apache/commons/jxpath/util
                        ValueUtils.java
  Log:
  Fixed this bug: if called setValue with an xpath with an
  index on a scalar property, the property would remain unchanged
  without an error message.
  
  Revision  Changes    Path
  1.8       +14 -5     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/ValueUtils.java
  
  Index: ValueUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/ValueUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ValueUtils.java	10 Aug 2002 01:19:09 -0000	1.7
  +++ ValueUtils.java	12 Oct 2002 20:57:44 -0000	1.8
  @@ -378,7 +378,16 @@
               }
           }
           // We will fall through if there is no indexed read
  -        setValue(getValue(bean, propertyDescriptor), index, value);
  +        Object collection = getValue(bean, propertyDescriptor);
  +        if (isCollection(collection)){
  +            setValue(collection, index, value);
  +        }
  +        else if (index == 0){
  +            setValue(bean, propertyDescriptor, value);
  +        }
  +        else {
  +            throw new RuntimeException("Not a collection: " + propertyDescriptor.getName());
  +        }
       }
   
       /**
  
  
  

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


Mime
View raw message