Skip to content

Hibernate Class Level Validators cause IllegalArgument Exception [SPR-8895] #13536

Closed
@spring-projects-issues

Description

@spring-projects-issues

Dan Ford opened SPR-8895 and commented

When a class level validator is invoked during "binding" of an input form with a "form object"/Bean, its failure to validate at the class level is treated as a "FieldError". This causes an IllegalArgumentException to be reported later from GenericConvesionService.convert() when it attempts to convert the Bean (i.e., the "value") to the type of the field, e.g., to String. This issue does not exist in 3.1.0.RC1. From 3.1.0.RC1 to 3.1.0.RC2, there was a change to SpringValidatorAdapter.validate(Object,Errors) that seems to be one/the source of this problem. Attached is an Eclipse/Maven project that demonstrates the issue. The pom.xml file has two profiles one for 3.1.0RC1 and one for 3.1.0.RC2. There are two Eclipse launch configurations defined that invoke Maven with one or the other profile active. Maven will start up Jetty and then run a single Selenium test that provides two different "passwords" for a "new user page". A "@Matches" validator will be called to compare these two values and will return "false" because they are different. The current logic seems to treat this as a "binding failure" and associates the Bean instance (the value being validated) with the "confirmationPassword" field as its "invalid value." The conversion service later tries to convert the Bean to a String, the type of the field, which causes the IllegalArgumentException to be thrown.


Affects: 3.1 RC2

Attachments:

Issue Links:

Referenced from: commits aedccec

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions