struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10191] - Validator Range Checking Bug
Date Mon, 24 Jun 2002 20:14:41 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10191>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10191

Validator Range Checking Bug





------- Additional Comments From jfarley@studentadvantage.com  2002-06-24 20:14 -------
I will post the diffs I generated here as well as post them to the struts-dev 
mailing list.  Thanks for the help!

Index: GenericValidator.java
===================================================================
RCS file: /home/cvspublic/jakarta-
commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
retrieving revision 1.5
diff -u -r1.5 GenericValidator.java
--- GenericValidator.java       2 Apr 2002 01:59:11 -0000       1.5
+++ GenericValidator.java       24 Jun 2002 20:06:32 -0000
@@ -247,7 +247,7 @@
      * @param  min             The minimum value of the range.
      * @param  max             The maximum value of the range.
     */
-    public static boolean isInRange(int value, int min, int max) {
+    public static boolean isInRange(double value, double min, double max) {
        return ((value >= min) && (value <= max));
     }

Index: StrutsValidator.java
===================================================================
RCS file: /home/cvspublic/jakarta-
struts/src/share/org/apache/struts/util/StrutsValidator.java,v
retrieving revision 1.2
diff -u -r1.2 StrutsValidator.java
--- StrutsValidator.java        2 Apr 2002 04:06:21 -0000       1.2
+++ StrutsValidator.java        24 Jun 2002 20:10:31 -0000
@@ -403,9 +403,9 @@

        if (!GenericValidator.isBlankOrNull(value)) {
           try {
-             int iValue = Integer.parseInt(value);
-             int min = Integer.parseInt(sMin);
-             int max = Integer.parseInt(sMax);
+             double iValue = Double.parseDouble(value);
+             double min = Double.parseDouble(sMin);
+             double max = Double.parseDouble(sMax);

              if (!GenericValidator.isInRange(iValue, min, max)) {
                 errors.add(field.getKey(), StrutsValidatorUtil.getActionError
(request, va, field));

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message