Skip to content

Recently changes of GenericTypeAwarePropertyDescriptor breaks BeanUtils.copyProperties() [SPR-11209] #15834

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions