Commits

Anonymous committed 8f07307

XW-571 (nested visitor validators break short-circuit functionality)
- added comment

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/xwork_1-2@1686e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits cfc9760
  • Branches xwork_1-2

Comments (0)

Files changed (1)

src/java/com/opensymphony/xwork/validator/AbstractActionValidatorManager.java

     }
 
 
+    /**
+     * An {@link com.opensymphony.xwork.validator.ValidatorContext} wrapper that
+     * returns the full field name
+     * {@link com.opensymphony.xwork.validator.AbstractActionValidatorManager.InternalValidatorContextWrapper#getFullFieldName(String)}
+     * by consulting it's parent if its an {@link com.opensymphony.xwork.validator.validators.VisitorFieldValidator.AppendingValidatorContext}.
+     * <p/>
+     * Eg. if we have nested Visitor
+     * AddressVisitor nested inside PersonVisitor, when using the normal #getFullFieldName, we will get
+     * "address.somefield", we lost the parent, with this wrapper, we will get "person.address.somefield".
+     * This is so that the key is used to register errors, so that we don't screw up short-curcuit feature
+     * when using nested visitor. See XW-571 (nested visitor validators break short-circuit functionality)
+     * at http://jira.opensymphony.com/browse/XW-571
+     */
     protected class InternalValidatorContextWrapper {
         private ValidatorContext validatorContext = null;
 
             this.validatorContext = validatorContext;
         }
 
+        /**
+         * Get the full field name by consulting the parent, so that when we are using nested visitors (
+         * visitor nested inside visitor etc.) we still get the full field name including its parents.
+         * See XW-571 for more details.
+         * @param field
+         * @return String
+         */
         public String getFullFieldName(String field) {
             if (validatorContext instanceof VisitorFieldValidator.AppendingValidatorContext) {
                 VisitorFieldValidator.AppendingValidatorContext appendingValidatorContext =