jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
693 stars 124 forks source link

Exception is thrown when exporting entity that contains field with double type from DataGrid using ExcelExportAction #3840

Closed Flaurite closed 1 week ago

Flaurite commented 2 weeks ago

Environment

Jmix version: 1.6.1 Ru support forum: topic.

Bug Description

If user selects Russian locale, the ExcelExporter will throw ParseException if a field has the Double type.

Steps To Reproduce

  1. Download project: demo-classic.zip
  2. Open Order dto screen.
  3. Export "Current page" to excel.

Current Behavior

java.text.ParseException: Unparseable number: "2.12"
    at io.jmix.core.metamodel.datatype.impl.NumberDatatype.parse(NumberDatatype.java:81)
    at io.jmix.core.metamodel.datatype.impl.DoubleDatatype.parse(DoubleDatatype.java:88)
    at io.jmix.core.metamodel.datatype.impl.DoubleDatatype.parse(DoubleDatatype.java:33)
    at io.jmix.gridexportui.exporter.excel.ExcelExporter.formatValueCell(ExcelExporter.java:750)
    at io.jmix.gridexportui.exporter.excel.ExcelExporter.createRowForEntityInstance(ExcelExporter.java:693)
    at io.jmix.gridexportui.exporter.excel.ExcelExporter.createRow(ExcelExporter.java:660)
    at io.jmix.gridexportui.exporter.excel.ExcelExporter.exportTable(ExcelExporter.java:243)
    at io.jmix.gridexportui.action.ExportAction.doExport(ExportAction.java:199)
    at io.jmix.gridexportui.action.ExportAction$3.actionPerform(ExportAction.java:163)
    at io.jmix.ui.sys.DialogsImpl$OptionDialogBuilderImpl.lambda$show$0(DialogsImpl.java:344)

Expected Behavior

No exception is thrown, excel file is downloaded.

Technical notes

Most probably caused by: https://github.com/jmix-framework/jmix/issues/2706 I guess the fix should be applied for FloatDatatype and not for the ExcelExporter. If so, revert changes in ExcelExporter(750). Also, take a look at 2.4 version.

Flaurite commented 1 week ago

For QA

Additionally check the case from https://github.com/jmix-framework/jmix/issues/2706