I would like to have the point of view of Camel developers concerning
the following point :

Camel bindy is able to parse string into Integer, Double Float,
BigDecimal values. The existing implementation uses :

DecimalFormat.parse( string) intValue() - doubleValue() - floatValue()
- longValue().

If we look to the Integer parsing, the existing issue is that a value
which is bigger than 2 exp 31 will be parsed in to the MAX value =
2147483647. This is not correct as we replace the original value by a
new. From a business point of view, the value should not be parsed and
an error like 'value bigger than max value' raised.

To avoid this kind of issue, we can combine a two steps test where we
check first if we can parse the String into an Integer using
Integer.parseInt( string ) followed DecimalFormat.parse( string)
intValue() . This approach will avoid the problem raised but by
example, if the pattern applied to DecimalFormat() has been defined
like '00' and the value encoded is '100000', no error is raised even
if we have exceeded the limit of 99.

Remark : for Integer, I have set setMaximumIntegerDigit( 2) but no
error has been generated.

Does anybody as ideas about how to check easily if the string to be
parsed does not exceed limits / is signed / ... ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard

Reply via email to