rleland 2002/10/14 09:35:25
Modified: src/share/org/apache/struts/util StrutsValidator.java
Log:
Deprecated validateRange() now
calls validatIntRange()
ValidateRange() will be removed before
Struts 1.1 final.
Revision Changes Path
1.10 +2 -31
jakarta-struts/src/share/org/apache/struts/util/StrutsValidator.java
Index: StrutsValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/StrutsValidator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StrutsValidator.java 11 Oct 2002 19:22:58 -0000 1.9
+++ StrutsValidator.java 14 Oct 2002 16:35:25 -0000 1.10
@@ -461,14 +461,12 @@
return result;
}
-
-
/**
* <p>
*
* Checks if a fields value is within a range (min & max specified in the
* vars attribute).</p>
- *@deprecated As of Struts 1.1, replaced by {@link
#validateIntRange(Object,ValidatorAction,Field,ActionErrors,HttpServletRequest)}
+ *@deprecated As of Struts 1.1b3, replaced by {@link
#validateIntRange(Object,ValidatorAction,Field,ActionErrors,HttpServletRequest)}
*@param bean The bean validation is being performed on.
*@param va The <code>ValidatorAction</code> that is currently being
performed.
*@param field The <code>Field</code> object associated with the current
@@ -482,34 +480,7 @@
ValidatorAction va, Field field,
ActionErrors errors,
HttpServletRequest request) {
-
- String value = null;
- if (isString(bean)) {
- value = (String) bean;
- } else {
- value = ValidatorUtil.getValueAsString(bean, field.getProperty());
- }
- String sMin = field.getVarValue("min");
- String sMax = field.getVarValue("max");
-
- if (!GenericValidator.isBlankOrNull(value)) {
- try {
- int iValue = Integer.parseInt(value);
- int min = Integer.parseInt(sMin);
- int max = Integer.parseInt(sMax);
-
- if (!GenericValidator.isInRange(iValue, min, max)) {
- errors.add(field.getKey(),
StrutsValidatorUtil.getActionError(request, va, field));
-
- return false;
- }
- } catch (Exception e) {
- errors.add(field.getKey(),
StrutsValidatorUtil.getActionError(request, va, field));
- return false;
- }
- }
-
- return true;
+ return validateIntRange(bean,va,field,errors,request);
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>