Commits

rainerh  committed 43eb89f

o fixed: The VisitorFieldValidator class does a push onto stack even when the value (field to validate) is null
Issue number: XW-300
Obtained from: http://jira.opensymphony.com/browse/XW-300
Submitted by: Ricardo Olivieri
Reviewed by: Rainer Hermanns

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@626e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits bd1b7a6

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork/validator/validators/VisitorFieldValidator.java

  * properties, Collections of Objects, or Arrays.
  *
  * @author Jason Carreira
+ * @author Rainer Hermanns
  *         Created Aug 2, 2003 10:27:48 PM
  */
 public class VisitorFieldValidator extends FieldValidatorSupport {
     public void validate(Object object) throws ValidationException {
         String fieldName = getFieldName();
         Object value = this.getFieldValue(fieldName, object);
+        if (value == null) {
+            return;
+        }
         OgnlValueStack stack = ActionContext.getContext().getValueStack();
+
         stack.push(object);
 
         String visitorContext = (context == null) ? ActionContext.getContext().getName() : context;
 
-        if (value == null) {
-            return;
-        }
-
         if (value instanceof Collection) {
             Collection coll = (Collection) value;
             Object[] array = coll.toArray();