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

   Fixes [WW-5729](https://issues.apache.org/jira/browse/WW-5729)
   
   ## What
   
   `ValueStackShadowMap` in the `jasperreports` plugin is meant to fall back to 
`ValueStack.findValue(name)` for any report parameter not put in the map 
explicitly, so a parameter declared in the `.jasper` can be resolved straight 
from the action. Its `containsKey(String)` / `get(String)` were *overloads* of 
the `HashMap` methods, not overrides, and JasperReports — which holds the map 
as `java.util.Map` — calls the `Object` variants. The fallback therefore never 
ran: a declared parameter exposed only as an action property rendered as `null`.
   
   This is a regression: the `Object` overrides were the original code, 
`2908d746c` (2019, "Minor code optimization") narrowed them to `String` while 
adding the generics, and it first shipped in 6.0.0. The `jasperreports7` copy 
already has the `@Override` form.
   
   ## Changes
   
   - `jasperreports/ValueStackShadowMap`: `containsKey(Object)` / `get(Object)` 
are now real overrides; the `String` overloads stay as deprecated delegates for 
binary compatibility.
   - Both copies: an explicit map entry wins even when its value is `null`, so 
`containsKey` and `get` agree and JasperReports skips the parameter's 
default-value expression consistently.
   - Tests in both plugins: `$P{title}` resolved from an action getter with no 
`reportParameters` (watched failing with `null Report` before the fix), and an 
explicit `title → null` entry not shadowed by the getter.
   
   ## Behaviour change — for the version notes
   
   Users of the 6.x-line plugin whose reports declare a parameter with the same 
name as an action property (or a Struts context key such as `session`, 
`request`, `parameters`, `locale`) will see that parameter start resolving from 
the value stack instead of its default-value expression, as the class Javadoc 
has always described and as the `jasperreports7` plugin already does. The 
lookup is type-blind — a `Long` parameter meeting an `int` getter, or a 
`session` parameter meeting the Struts `SessionMap`, fails at fill time with a 
`ClassCastException`. Rename the report parameter or supply it through 
`reportParameters` in that case.
   
   🤖 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