-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Description
Phil Webb opened SPR-10243 and commented
After updating Spring from 3.2.0.RELEASE to 3.2.1.RELEASE I've got following error:
[skip]
java.lang.IllegalArgumentException: The source to convert from must be an instance of @org.hibernate.validator.constraints.NotEmpty @javax.validation.constraints.Size @javax.validation.constraints.Pattern java.lang.String; instead it was a ru.mystamps.web.model.ActivateAccountForm
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:164)
at org.springframework.validation.AbstractPropertyBindingResult.formatFieldValue(AbstractPropertyBindingResult.java:125)
at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:222)
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)
at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:130)
at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:120)
at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:90)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
at org.apache.jsp.WEB_002dINF.tiles.body.account.activate_jsp._jspx_meth_form_label_2(activate_jsp.java:667)
at org.apache.jsp.WEB_002dINF.tiles.body.account.activate_jsp._jspService(activate_jsp.java:224)
[skip]
JSP code:
<form:form method="post" action="${activateUrl}" modelAttribute="activateAccountForm">
<form:label path="login">
<spring:message code="t_login" />
</form:label>
...
</form:form>
Model declaration:
public class ActivateAccountForm implements ActivateAccountDto {
@NotEmpty(groups = Login1Checks.class)
@Size.List({
@Size(
min = ValidationRules.LOGIN_MIN_LENGTH,
message = "{value.too-short}",
groups = Login2Checks.class
),
@Size(
max = ValidationRules.LOGIN_MAX_LENGTH,
message = "{value.too-long}",
groups = Login2Checks.class
)
})
@Pattern(
regexp = ValidationRules.LOGIN_REGEXP,
message = "{login.invalid}",
groups = Login3Checks.class
)
@UniqueLogin(groups = Login4Checks.class)
private String login;
...
}
Controller:
@RequestMapping(value = Url.ACTIVATE_ACCOUNT_PAGE, method = RequestMethod.POST)
public String processActivationForm(
@Validated({
LoginChecks.class, NameChecks.class, PasswordChecks.class,
PasswordConfirmationChecks.class, ActKeyChecks.class, FormChecks.class
}) ActivateAccountForm form, BindingResult result) {
if (result.hasErrors()) {
return null;
}
userService.registerUser(form);
return "redirect:" + Url.SUCCESSFUL_ACTIVATION_PAGE;
}
Affects: 3.2.1
Reference URL: http://stackoverflow.com/questions/14522260/genericconversionservice-convert-throws-illegalargumentexception-after-updatin
Issue Links:
- SpringValidatorAdapter is incorrectly resolving rejected value for bean based field level constraints [SPR-9332] #13970 SpringValidatorAdapter is incorrectly resolving rejected value for bean based field level constraints
- SpringValidationAdapter cannot handle disabled default constraint violation [SPR-10345] #14979 SpringValidationAdapter cannot handle disabled default constraint violation
- Spring validation crashes with Hibernate Validation 5 style list constraint violations [SPR-15082] #19648 Spring validation crashes with Hibernate Validation 5 style list constraint violations
- NumberFormatException caused by property paths from JSR-303 based validation with no index into a collection [SPR-16177] #20725 NumberFormatException caused by property paths from JSR-303 based validation with no index into a collection
Referenced from: commits cef9781, 19eecb1
0 votes, 5 watchers
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug