lukaszlenart opened a new pull request, #1919:
URL: https://github.com/apache/struts/pull/1919

   Fixes [WW-3245](https://issues.apache.org/jira/browse/WW-3245)
   
   ## What
   
   Both JasperReports result types (`jasperreports` and `jasperreports7` 
plugins) required either `dataSource` or `connection` and only ever called the 
three-argument `JasperFillManager.fillReport` overloads. A report whose data 
comes from a JasperReports query executer — Hibernate (`HIBERNATE_SESSION`), 
CSV, JSON, EJBQL, XPath… — could therefore not be filled without first 
materialising a `List` in the action, which is what the ticket (2009) asks to 
remove.
   
   When neither is configured, the result now calls `fillReport(report, 
parameters)` and lets JasperReports resolve its data from the parameter map 
exactly as its standalone API does. The supplier object the executer expects, 
or a ready `REPORT_DATA_SOURCE` / `REPORT_CONNECTION`, is handed over via 
`reportParameters`.
   
   ## Why this shape and not the attached patch
   
   The 2009 patch special-cased `HIBERNATE_SESSION` and imported 
`JRHibernateQueryExecuterFactory`. JasperReports 7 moved that class out of the 
core jar into the optional `jasperreports-hibernate` artifact, so the patch 
would not compile against the jasperreports7 plugin, and every other executer 
would still be locked out. Delegating to the two-argument overload needs no key 
inspection and no new dependency, and works for every present and future 
executer.
   
   Precedence is unchanged: `connection` → `dataSource` → parameters-only. The 
acceptance checks on the `dataSource` and `reportParameters` expressions still 
run whenever they are set. When the parameter map carries nothing the executer 
can use, the outcome is JasperReports' own (the JDBC executer logs and fills 
per `whenNoDataType`, Hibernate throws) — the plugin adds no policy of its own; 
a debug line marks the parameters-only path so a forgotten `dataSource` stays 
diagnosable.
   
   ## Tests
   
   One new test per plugin, 
`testFillFromReportParametersWithoutDataSourceOrConnection`: a `csv.jrxml` 
fixture with a `csv` query and no `dataSource`/`connection` on the result, 
`CSV_INPUT_STREAM` supplied via `reportParameters`, XML export asserted to 
contain the CSV row. Both failed with `No dataSource specified...` before the 
change.
   
   Docs: companion struts-site PR follows.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to