[ 
http://www.stripesframework.org/jira/browse/STS-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Fennell resolved STS-390.
-----------------------------

       Resolution: Fixed
    Fix Version/s: Release 1.5

I've made the changes you suggested, and in addition made sure that the type 
converters for integral types use integer instances of NumberFormat.  Thanks 
for the pointer to the article.  I've always wanted to do this but not known a 
good way to solve the problem that is locale sensitive (until now).

> More strict number parsing
> --------------------------
>
>                 Key: STS-390
>                 URL: http://www.stripesframework.org/jira/browse/STS-390
>             Project: Stripes
>          Issue Type: Improvement
>          Components: Validation
>    Affects Versions: Release 1.4.3
>            Reporter: Karel Kolman
>             Fix For: Release 1.5
>
>
> NumberTypeConverterSupport should check for number parsing errors by other 
> means than by catching ParseExceptions only.
> Let's say I'm entering the values 0.2 and 0,2 (with different decimal 
> separators) into a BigDecimal field. The value is set to either 0 or 0.2 
> according to the locale Stripes selects. The case when 0.2 gets parsed into 0 
> without producing an error is causing me trouble.
> The NumberTypeConverterSupport parsing code is:
> try { return format.parse(input); }
> catch (ParseException pe) { /* Do nothing. */ }
> I think it should be something like this:
> ParsePosition parsePos = new ParsePosition(0);
> Number number = format.parse(input, parsePos);
> if (number != null && input.length == parsePos.getIndex()) return number;
> IMHO using NumberFormat.parse(String source, ParsePosition parsePosition) is 
> a better alternative to parse(String source)
> (also see this article
> http://www.ibm.com/developerworks/java/library/j-numberformat/
> )

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to