commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alice Boxhall <>
Subject BeanUtils/IntegerConverter: Why aren't strings trimmed?
Date Mon, 21 Feb 2005 02:44:05 GMT

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.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message