I am having a problem now using a Map with BeanUtils.populate. Below is
the class 'Example' and it the error I get when running it with
BeanUtils 1.7.0 on Java 6 update 1. I notice when debugging the code the
'value' to be invoked for the 'setMap' method is a String with value of
"{}"...which would explain the argument type mismatch, so is this a bug
in BeanUtils?? I'm not sure what is going on because this just started
being a problem for me today.
public class Example {
public Example() {
}
private Map map = new HashMap();
public Map getMap() {
return map;
}
public void setMap(Map map) {
this.map = map;
}
public static void main(String[] args) throws Exception {
Example d = new Example();
Map m = BeanUtils.describe(d);
System.out.println(m);
Example rd = (Example)
Class.forName(Example.class.getCanonicalName()).newInstance();
BeanUtils.populate(rd, m);
}
}
java.lang.IllegalArgumentException: Cannot invoke
net.nighthawk.ifd.ads.Example.setMap - argument type mismatch
at
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
at
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at net.nighthawk.ifd.ads.Example.main(Example.java:23)
--
Aaron Bruegl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]