Closed
Description
Marko Umek opened SPR-11209 and commented
In release 3.2.4 BeanUtils.copyProperties() ignores invalid property definirions like these:
public class InvalidBean {
public String getValue() {...}
public void setValue(int intValue) {...}
}
The culprit lies in class GenericTypeAwarePropertyDescriptor line 72, 73:
Method candidate = ClassUtils.getMethodIfAvailable(
this.beanClass, "set" + StringUtils.capitalize(getName()), (Class<?>[]) null); // < Missing return type (!)
if (candidate != null && candidate.getParameterTypes().length == 1) {
writeMethodToUse = candidate;
}
versus
writeMethodToUse = ClassUtils.getMethodIfAvailable(this.beanClass,
"set" + StringUtils.capitalize(getName(), readMethodToUse.getReturnType());
Affects: 3.2.5
Referenced from: commits bc5affa, bfcfbe4
Backported to: 3.2.6