Revision: 311
Author:   tfenne
Date:     2006-05-11 04:35:16 -0700 (Thu, 11 May 2006)
ViewCVS:  http://svn.sourceforge.net/stripes/?rev=311&view=rev

Log Message:
-----------
Fix for STS-197: FloatTypeConverter cannot convert 0 or negative numbers.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/validation/FloatTypeConverter.java
Modified: 
trunk/stripes/src/net/sourceforge/stripes/validation/FloatTypeConverter.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/validation/FloatTypeConverter.java    
    2006-05-11 00:15:15 UTC (rev 310)
+++ 
trunk/stripes/src/net/sourceforge/stripes/validation/FloatTypeConverter.java    
    2006-05-11 11:35:16 UTC (rev 311)
@@ -25,6 +25,10 @@
  * @author Tim Fennell
  */
 public class FloatTypeConverter extends NumberTypeConverterSupport implements 
TypeConverter<Float> {
+    /** The minimum value that can assigned to a float or Float. */
+    public static final float MIN_VALUE = -Float.MAX_VALUE;
+    /** The maximum value that can assigned to a float or Float. */
+    public static final float MAX_VALUE = Float.MAX_VALUE;
 
     /**
      * Converts the input to an object of type Double.
@@ -38,9 +42,9 @@
 
         if (errors.size() == 0) {
             double output = number.doubleValue();
-            if (output > Float.MAX_VALUE || output < Float.MIN_VALUE) {
+            if (output > MAX_VALUE || output < MIN_VALUE) {
                 errors.add( new ScopedLocalizableError("converter.float", 
"outOfRange",
-                                                       Float.MIN_VALUE, 
Float.MAX_VALUE));
+                                                       MIN_VALUE, MAX_VALUE));
             }
             else {
                 retval = new Float(number.floatValue());


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to