|
[
Permlink
| « Hide
]
Mathias Bogaert added a comment - 19/Oct/04 07:36 AM
This is very simple; in ValidationAwareSupport, change the internalGetFieldErrors method to initialize the fieldErrors with a LinkedHashMap instead of the current HashMap. I don't have developer access to XWork module, so I can't change this right now.
This issue still happens in xwork-1.1.1.jar. I'll attach my User-validation.xml so you can see the order of validation rules. The error messages are stacked in a somewhat random order:
E-Mail is a required field. Username is a required field. Password Hint is a required field. First Name is a required field. State is a required field. Zip is a required field. City is a required field. Country is a required field. Password is a required field. Website is a required field. Last Name is a required field. Confirm Password is a required field. validation file that has rules in preferred order of error output
just skimming through the code, and notice somthing that might be causing this bug.
At ValidationAwareSupport.java private Map internalGetFieldErrors() { if (fieldErrors == null) { fieldErrors = new HashMap(); } return fieldErrors; } should instead be private Map internalGetFieldErrors() { if (fieldErrors == null) { fieldErrors = new LinkedHashMap(); } return fieldErrors; } LinkedHashMap or some map which honours sequence in added order should be used. I will work on some testcase within the next few days (hopefully) to verify it. changes are :
src/test/com/opensymphony/xwork/ValidationOrderAction-validation.xml src/test/com/opensymphony/xwork/ValidationOrderAction.java src/java/com/opensymphony/xwork/ValidationAwareSupport.java src/test/com/opensymphony/xwork/validator/DefaultActionValidatorManagerTest.java |
||||||||||||||||||||||||||||||||||||||||||