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

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

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

   Fixes [WW-5732](https://issues.apache.org/jira/browse/WW-5732)
   
   The exporter providers are registered under the lower-case names from 
`JasperReport7Constants` and the container lookup is exact, so the upper-case 
`CSV` in the class Javadoc example — and in any config migrated from the 6.x 
plugin, whose constants are upper-case — failed with `No exporter found for 
format: CSV`.
   
   `JasperReport7Result` now looks the provider up by the configured name first 
and, when nothing is registered under it, by its lower-cased form 
(`Locale.ROOT`). `csv`, `Csv` and `CSV` all select the bundled provider, while 
a custom provider registered under a mixed-case bean name keeps precedence. The 
`Content-Disposition` filename keeps the configured spelling, as before. 
Javadoc example switched to `csv` and the `format` bullet notes the 
case-insensitive match.
   
   Test `testFormatLookupIsCaseInsensitive` (`setFormat("CSV")`) failed with 
the exception above before the change.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




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

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

> JasperReport7Result Javadoc example uses upper-case format "CSV" which fails 
> the exporter lookup
> ------------------------------------------------------------------------------------------------
>
>                 Key: WW-5732
>                 URL: https://issues.apache.org/jira/browse/WW-5732
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Trivial
>             Fix For: 7.4.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The class Javadoc of {{JasperReport7Result}} (snippet {{example1}}) shows
> {code:xml}<result name="success" type="jasperReport7">
>   <param name="location">foo.jasper</param>
>   <param name="dataSource">mySource</param>
>   <param name="format">CSV</param>
> </result>
> {code}
> but the result resolves the exporter with
> {code:java}invocation.getInvocationContext().getContainer().getInstance(JasperReport7ExporterProvider.class,
>  format)
> {code}
> and the providers are registered in {{struts-plugin.xml}} under the 
> lower-case names {{pdf}}, {{csv}}, {{html}}, {{xlsx}}, {{xml}}, {{rtf}} (the 
> values of {{JasperReport7Constants.FORMAT_*}}). The container lookup is 
> case-sensitive and {{format}} is never lower-cased, so copying the example 
> gives {{StrutsException: No exporter found for format: CSV}}.
> The 6.x plugin used upper-case constants ({{FORMAT_CSV = "CSV"}}), which is 
> presumably where the example came from.
> Either fix the example to {{csv}} and state in the {{format}} parameter 
> description that the value is case-sensitive, or lower-case {{format}} in 
> {{initializeProperties}} so both spellings work; the second also eases 
> migration from the 6.x plugin. The site page added in WW-5728 documents the 
> lower-case values.



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

Reply via email to