impliedDecimalSeparator not working for numbers starting with 0
With Camel 2.11 the impliedDecimalSeparator appears to have a problem with numbers starting with 0. For example: @DataField(pos = 1, precision = 10, length = 11, impliedDecimalSeparator = true) private BigDecimal foobar; value: 0123567 Throws an error Non-terminating decimal expansion; no exact representable decimal result. caused by java.math.BigDecimal.divide(BigDecimal.java:1616) org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:38) org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:23) (...) >From what I've been able to follow in the SVN updates for Camel 2.11.0 for this change it looks like perhaps the result.divide may be trying to divide by a zero multiplier, but I'm not 100% sure. -- View this message in context: http://camel.465427.n5.nabble.com/impliedDecimalSeparator-not-working-for-numbers-starting-with-0-tp5732448.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: impliedDecimalSeparator not working for numbers starting with 0
It looks we need to add a rounding mode when calling the divide method. The default value which is used in the divide method is RoundingMode.UNNECESSARY. You will get the exception when the divide method don't know how to round. -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 14, 2013 at 5:50 AM, double_nill wrote: > With Camel 2.11 the impliedDecimalSeparator appears to have a problem with > numbers starting with 0. For example: > > @DataField(pos = 1, precision = 10, length = 11, impliedDecimalSeparator = > true) private BigDecimal foobar; > > value: 0123567 > > Throws an error > > Non-terminating decimal expansion; no exact representable decimal result. > caused by > java.math.BigDecimal.divide(BigDecimal.java:1616) > org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:38) > org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:23) > (...) > > From what I've been able to follow in the SVN updates for Camel 2.11.0 for > this change it looks like perhaps the result.divide may be trying to divide > by a zero multiplier, but I'm not 100% sure. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/impliedDecimalSeparator-not-working-for-numbers-starting-with-0-tp5732448.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: impliedDecimalSeparator not working for numbers starting with 0
I just found there are some bugs in the code, so I fill a JIRA[1] for it. [1]https://issues.apache.org/jira/browse/CAMEL-6358 -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 14, 2013 at 10:24 AM, Willem jiang wrote: > It looks we need to add a rounding mode when calling the divide method. > The default value which is used in the divide method is > RoundingMode.UNNECESSARY. > You will get the exception when the divide method don't know how to round. > > > -- > Willem Jiang > > Red Hat, Inc. > FuseSource is now part of Red Hat > Web: http://www.fusesource.com | http://www.redhat.com > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > > > On Tuesday, May 14, 2013 at 5:50 AM, double_nill wrote: > > > With Camel 2.11 the impliedDecimalSeparator appears to have a problem with > > numbers starting with 0. For example: > > > > @DataField(pos = 1, precision = 10, length = 11, impliedDecimalSeparator = > > true) private BigDecimal foobar; > > > > value: 0123567 > > > > Throws an error > > > > Non-terminating decimal expansion; no exact representable decimal result. > > caused by > > java.math.BigDecimal.divide(BigDecimal.java:1616) > > org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:38) > > org.apache.camel.dataformat.bindy.format.BigDecimalFormat.parse(BigDecimalFormat.java:23) > > (...) > > > > From what I've been able to follow in the SVN updates for Camel 2.11.0 for > > this change it looks like perhaps the result.divide may be trying to divide > > by a zero multiplier, but I'm not 100% sure. > > > > > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/impliedDecimalSeparator-not-working-for-numbers-starting-with-0-tp5732448.html > > Sent from the Camel - Users mailing list archive at Nabble.com > > (http://Nabble.com). > > > >