[ 
https://issues.apache.org/jira/browse/WW-5731?focusedWorklogId=1041100&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1041100
 ]

ASF GitHub Bot logged work on WW-5731:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Sep/26 09:35
            Start Date: 12/Sep/26 09:35
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1921:
URL: https://github.com/apache/struts/pull/1921

   Fixes [WW-5731](https://issues.apache.org/jira/browse/WW-5731)
   
   `JasperReport7CsvExporterProvider` set the configured delimiter as both the 
field *and* the record delimiter, so every CSV export came out as a single line 
with the rows joined by `,` (or whatever 
`struts.jasperReport7.csv.defaultDelimiter` / 
`JasperReport7Aware.getCsvDelimiter` returned). Only the field delimiter is 
meant to be configurable — as in the 6.x plugin, which sets `FIELD_DELIMITER` 
alone — so the `setRecordDelimiter` call is dropped and JasperReports' default 
newline applies.
   
   Test `testCsvRecordsAreSeparatedByNewlines` uses `;` as the field delimiter 
and two rows; before the fix the export was `Qux Report;Hello Foo Bar!;Hello 
Baz Qux!;`, now it is three lines.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1041100)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.4.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{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