Hi Rafa,

well spotted! The PR has been applied. If you have no more immediate fixes pending, we could put out the 4.0.3 release this week.

Cheers

On 04/08/2015 14:07, Rafael Jimenez wrote:

Hi all,


NumberConverter allow values like 'HelloWorld123' to be converter into 123 as BigDecimal. This can lead into wrong data, without user noticing.


There are some non digit characters like dot ('.') and comma (',') that we should allow, in order to ease reading of big numbers like:


1.000.000,12 or 1,000,000.12 depending on the Locale.


https://github.com/rjimgal/jbehave-bigdecimal-converter project demonstrates how '0x1A' is converted into BigDecimal 1, while one could expect NumberConverter to support hex inputs.


PR https://github.com/jbehave/jbehave-core/pull/91 has been created with a possible implementation.


I've changed the regular expression to only support dot and comma (apart from - for negative numbers).


There were some tests created for these case, however they were not properly checking that the exception was thrown, i.e. catch block wasn't executed at all, because no exception was thrown.


Finally, I've checked if more than one decimal point has been found, however it'd be a valid use case to use:


1...00,12 or 1,,,0.12 depending on the Locale.


I don't know if we should add those extra checks, specially since all the different possible valid use cases (I'm thinking in Hindi and so on).


WTDY?



Best Regards,


Rafa.

--
You received this message because you are subscribed to the Google Groups "JBehave Dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. To view this discussion on the web, visit https://groups.google.com/d/msgid/jbehave-dev/82981b8e-5f03-45a1-afb5-666775dfc3b4%40googlegroups.com <https://groups.google.com/d/msgid/jbehave-dev/82981b8e-5f03-45a1-afb5-666775dfc3b4%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "JBehave 
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/55C1B14C.5030800%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to