Closed spring-projects-issues closed 20 years ago
Seth Ladd commented
The patch. Tested, though forgot to add a unit test. Will do so now.
Seth Ladd commented
Drat, can't run tests in windows. I'll try tomorrow at work and write a specific unit test for this.
A run of ant tests results in:
buildtests: [mkdir] Created dir: C:\eclipse\workspace\spring\target\test-classes [javac] Compiling 260 source files to C:\eclipse\workspace\spring\target\tes t-classes [javac] C:\eclipse\workspace\spring\target\generated-commons-attributes-test \org\springframework\aop\framework\autoproxy\metadata\TxClassImpl$attributeRep ository.java:32: cannot resolve symbol [javac] symbol : class DefaultTransactionAttribute [javac] location: class org.springframework.aop.framework.autoproxy.metadata .TxClassImpl$attributeRepository [javac] DefaultTransactionAttribute _attr = new DefaultTransact ionAttribute (TransactionDefinition.PROPAGATION_REQUIRED // C:/eclipse/workspac e/spring/test/org/springframework/aop/framework/autoproxy/metadata/TxClassImpl.j ava:35 [javac] ^
Seth Ladd commented
The Validation tests pass fine. The above error is not related.
Juergen Hoeller commented
Good idea, Seth - just applied, in a factored-out "getArgumentsForBindingError" method. Juergen
Seth Ladd opened SPR-120 and commented
If an exception is thrown during binding, for instance, if a value cannot be converted to the expected type, then this patch makes the error message (FieldError) more specific. That is, it included the object name with the field name and makes it a MessageSourceResolvable, so that a more specific error message may be displayed.
This comes in handy when binding from a web submission, from a String to a java.lang.Integer (for instance). Instead of saying "fieldName was not a number" we're now about to say commandObjectName.fieldName and translate that. Also, it gives an array of possible variables, objectName.fieldName and just fieldName.
Please let me know if this should be flushed out. Thanks for committing the previous request for making MessageSourceResolvables recursive. It makes things like this possible! :)
Affects: 1.0.1
Attachments: