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

   ## Summary
   
   Fixes [WW-5587](https://issues.apache.org/jira/browse/WW-5587) - 
`WithLazyParams` interceptors lose parameters in stack configurations.
   
   This is a critical bug fix that completes the work started in WW-5586. Even 
after WW-5586's fix, `WithLazyParams` interceptors still couldn't work properly 
in stack configurations because the parameter map wasn't being preserved in 
`InterceptorMapping`.
   
   ## Problem
   
   In `InterceptorBuilder.constructParameterizedInterceptorReferences()` at 
line 177, the code was creating `InterceptorMapping` instances using the 
2-argument constructor:
   
   ```java
   InterceptorMapping mapping = new InterceptorMapping(key, interceptor);
   ```
   
   This constructor defaults to an **empty params map**, which breaks the lazy 
parameter injection mechanism:
   
   1. At factory time: Interceptor properties are set (thanks to WW-5586) ✅
   2. At invocation time: `LazyParamInjector.injectParams()` needs the params 
map to re-evaluate expressions ❌
   3. But `interceptorMapping.getParams()` returns empty → nothing to 
re-evaluate ❌
   4. Result: Expression parameters like `${someValue}` stay as literal strings 
❌
   
   ## Solution
   
   Pass the `map` parameter to the 3-argument constructor:
   
   ```java
   InterceptorMapping mapping = new InterceptorMapping(key, interceptor, map);
   ```
   
   This simple one-line change ensures the params map is preserved for 
`LazyParamInjector` to use during action invocation.
   
   ## Changes
   
   - **InterceptorBuilder.java:177** - Added `map` parameter to 
`InterceptorMapping` constructor
   - **DefaultActionInvocationTest.java** - Enhanced test to verify params are 
preserved in `InterceptorMapping`
   - **Research document** - Added comprehensive analysis of both WW-5586 and 
WW-5587 bugs
   
   ## Test Coverage
   
   Enhanced existing test `testInvokeWithLazyParamsStackConfiguration()` to 
assert that:
   - `WithLazyParams` interceptors have non-empty params in `InterceptorMapping`
   - Expression parameters are correctly evaluated at invocation time
   - Static parameters remain unchanged
   
   Test passes successfully ✅
   
   ## Related Issues
   
   - Fixes: WW-5587
   - Related: WW-5586 (partial fix - only fixed factory-time initialization)
   
   ## Impact
   
   This fix enables the complete dual initialization pattern for 
`WithLazyParams` interceptors:
   1. **Factory time**: Properties set with literal values (including 
expression strings)
   2. **Invocation time**: Expression parameters re-evaluated from ValueStack
   
   Without this fix, `WithLazyParams` interceptors cannot be used with 
parameter overrides in interceptor stacks.
   
   🤖 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