Jump to content
  • Bug at converting BigDecimal numbers


    Aysel.Togan-Salli
    Assigned User lucianc
    CategoryBug report
    PriorityHigh
    ReproducibilityAlways
    ResolutionFixed
    SeverityCritical
    StatusResolved
    Versionv6.17.0

    Jasperreport converts floating point numbers depending on location. While debugging reading the fields of a Json data, we found out that Jasperreports uses a locale dependent method of org.apache.commons.beanutils for the conversion, namely LocaleConvertUtilsBean.convert(String, Class<?>, Locale, String). This method uses the defaultLocale parameter, which produces an incorrect result for floating-point numbers.

    For example the number 216.14 is converted to €21.614,00 or 257.2066 to €2.572.066,00.

    Json uses a period to indicate the decimal place. But there are locales (for example "de") in which the semantics of "." and "," are reversed, since in "de" a period is used as thousands separator instead of a decimal separator.



    User Feedback

    Recommended Comments


×
×
  • Create New...