Lukasz Lenart created WW-5732:
---------------------------------
Summary: 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
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)