You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alice Boxhall <al...@aconex.com> on 2005/02/21 03:44:05 UTC
BeanUtils/IntegerConverter: Why aren't strings trimmed?
Hi,
I spent this morning debugging an Exception in my code that I traced
back to BeanUtils.setProperty passing a number String with a trailing
space to IntegerConverter.
I was wondering whether there was any reason why Strings to be passed to
a Number parser couldn't have the trim() method run on them first, given
that the type to which the Object is being converted is known before it
is passed to the Converter.
Obviously the current implementation basically forces the .properties
file to obey the contract set by Integer.parseInt, but in my case the
trailing space wasn't visible for some reason in the editor I was using
and it was the cause of quite a bit of frustration that what was
otherwise a well-formed number String was causing a NumberFormatException.
Cheers,
Alice
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org