Lukasz Lenart created WW-5731:
---------------------------------

             Summary: JasperReport7CsvExporterProvider sets the record 
delimiter to the field delimiter
                 Key: WW-5731
                 URL: https://issues.apache.org/jira/browse/WW-5731
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - JasperReports
            Reporter: Lukasz Lenart


{{JasperReport7CsvExporterProvider.createExporter}} in 
{{struts2-jasperreports7-plugin}} configures the CSV exporter with

{code:java}SimpleCsvExporterConfiguration config = new 
SimpleCsvExporterConfiguration();
config.setFieldDelimiter(reportDelimiter);
config.setRecordDelimiter(reportDelimiter);
{code}

so records are separated by the field delimiter ({{,}} by default, or whatever 
{{struts.jasperReport7.csv.defaultDelimiter}} / 
{{JasperReport7Aware.getCsvDelimiter}} returns) instead of a newline. The 
exported CSV comes out as a single line.

The 6.x plugin ({{JasperReportsResult}}) only sets 
{{JRCsvExporterParameter.FIELD_DELIMITER}}, so this looks like a copy-paste 
slip from WW-5455. Dropping the {{setRecordDelimiter}} call restores 
JasperReports' default record delimiter ({{\n}}).

{{JasperReport7ResultTest.testExportToCsv}} does not catch it because it only 
asserts that the output contains the report title; an assertion on the line 
count would.

Affects every release since 7.1.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to