Commits

Anonymous committed dcdfa63

@StringLengthFieldValidator creates log-warnings when not setting property maxLength
Issue number: XW-335
Obtained from:
Submitted by:
Reviewed by:

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

  • Participants
  • Parent commits 0c909ad

Comments (0)

Files changed (1)

File tiger/src/java/com/opensymphony/xwork/validator/AnnotationValidationConfigurationBuilder.java

             params.put("fieldName", v.fieldName());
         }
 
-        params.put("maxLength", v.maxLength());
-        params.put("minLength", v.minLength());
+        if ( v.maxLength() != null && v.maxLength().length() > 0) {
+            params.put("maxLength", v.maxLength());
+        }
+        if ( v.minLength() != null && v.minLength().length() > 0) {
+            params.put("minLength", v.minLength());
+        }
         params.put("trim", v.trim());
 
         ValidatorFactory.lookupRegisteredValidatorType(validatorType);
             params.put("fieldName", v.fieldName());
         }
 
-        params.put("min", v.min());
-        params.put("max", v.max());
+        if ( v.min() != null && v.min().length() > 0) {
+            params.put("min", v.min());
+        }
+        if ( v.max() != null && v.max().length() > 0) {
+            params.put("max", v.max());
+        }
 
         ValidatorFactory.lookupRegisteredValidatorType(validatorType);
         ValidatorConfig vCfg = new ValidatorConfig(validatorType, params);
         } else if (v.fieldName() != null && v.fieldName().length() > 0 ) {
             params.put("fieldName", v.fieldName());
         }
-        params.put("min", v.min());
-        params.put("max", v.max());
+        if ( v.min() != null && v.min().length() > 0) {
+            params.put("min", v.min());
+        }
+        if ( v.max() != null && v.max().length() > 0) {
+            params.put("max", v.max());
+        }
 
         ValidatorFactory.lookupRegisteredValidatorType(validatorType);
         ValidatorConfig vCfg = new ValidatorConfig(validatorType, params);