You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Schaal, Roland" <R....@Verband.Creditreform.de> on 2006/11/13 11:27:59 UTC

WG: Unexpected behavior of NumberConverter

Hello,
 
maybe one of you can answer this?!
 
Regards,
Roland

________________________________

Von: Schaal, Roland 
Gesendet: Mittwoch, 8. November 2006 09:58
An: MyFaces Discussion
Betreff: Unexpected behavior of NumberConverter


Hello,
 
I have an input component which uses the f:convertNumber tag to convert
the input to a Number object.
 
When I type the value "x12345" it gives me a ConversionError as
expected.
But when I type the value "123x45" there is no ConversionError but it
converts this input to the Number "123" and cuts the rest of it. I would
also expect a ConversionError as this input is not a valid Number...?!
 
Can anyone confirm this to be a bug of the NumberConverter?
 
Looking into the source of NumberConverter I see that it uses
DecimalFormat to parse the input into Number which definitive cuts the
String value in the descibed way. Maybe there should also be a
verification for any character of the typed input string.
What do others think?
 
Regards,
Roland