DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29571>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29571

Inconsistent behaviour of BeanUtils.setProperty() and BeanUtils.getProperty() methods

           Summary: Inconsistent behaviour of BeanUtils.setProperty() and
                    BeanUtils.getProperty() methods
           Product: Commons
           Version: 1.6 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I assume, that setProperty(bean, name, value) works iff getProperty(bean, name)
works. But in bean utils 1.6.1 this is not the case.

Here is an example:

a simple class

public class Form {
  private Map[] values;

  public Map[] getValues() { ... }
  public void setValues(Map[] values) { ... }
}

use of this class in some code:
  ...

  Map[] values = new HashMap[4];
  for(int i = 0; i < 4; i++) {
      Map value = new HashMap(2);
      value.put("value", i+"value");
      value.put("label", i+"label");
      values[i] = value;
  }
 
  Form ourForm = new Form();
  form.setVaules(values);
   // now the important part!!!
  String label = BeanUtils.getProperty(form, "values[2].label");
  // the value of label is: "2label"
  // lets make a change;
  BeanUtils.setProperty(form, "values[2].label", "doesItWork?");
  label = BeanUtils.getProperty(form, "values[2].label");
  // unfortunately the value of label is still: "2label"
  ...
------- end of example -----

I must note, that if I were to use PropertyUtils instead of BeanUtils, the whole
example would work as expected. The implementation of getProprerty in BeanUtils
is more or less a wraper around PropertyUtils method. But the setProperty method
is far more complicated and i don't feel competent to change it.

I'm using struts, nad this bug really hurts me.

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

Reply via email to