-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Oliver Becker opened SPR-7019 and commented
When validating nested properties, Spring computes a wrong property path (a.k.a. fieldname).
See org.springframework.validation.AbstractBindingResult
public String[] resolveMessageCodes(String errorCode, String field) {
String fixedField = fixedField(field);
Class fieldType = getFieldType(fixedField);
return getMessageCodesResolver().resolveMessageCodes(errorCode, getObjectName(), fixedField, fieldType);
}
The problem is that getFieldType will be called already with a fixedField parameter. However, getFieldType again invokes fixedField(String) with the passed string. So in the end the fixedField method will be called twice, which in turn prepends a nestedPath twice.
The quickfix is most probably to change the second line of resolveMessageCodes into
Class fieldType = getFieldType(field);
Affects: 3.0.1
Referenced from: commits a2c3274
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug