[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    DO NOT REPLY [Bug 36878]  New:  -
From:       bugzilla () apache ! org
Date:       2005-09-30 15:10:48
Message-ID: 20050930151048.BAA6DE1 () ajax ! apache ! org
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36878>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36878

           Summary: GenericTypeValidator does not accept negative
                    Floats/Doubles
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Validator
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: newsScott@gmx.de


There's a bug in the validation code of formatFloat:

---snip---
                if (num.doubleValue() >= (Float.MIN_VALUE * -1) &&
                    num.doubleValue() <= Float.MAX_VALUE) {
                    result = new Float(num.floatValue());
                }
---snip---

The lower border is checked against (Float.MIN_VALUE * -1). In contrast to
Integer.MIN_VALUE, Float.MIN_VALUE does not represent the minimum value, but the
smallest non-negative value. So the above check would crop all of the negative
values.

The same also applies to formatDouble.

There's also an issue with the delimiter which is used to mark powers of 10^3:
With Locale.US the following is accepted:

2.5 This is ok
2,500.0 This is ok
2,5.0 This is transformed into 25.0

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic