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

   Fixes [WW-5687](https://issues.apache.org/jira/browse/WW-5687)
   
   Follow-on of WW-5537, defence-in-depth: `StrutsTypeConverterHolder` 
(`defaultMappings`, `mappings`, `unknownMappings`) and 
`DefaultActionValidatorManager` (`validatorCache`, `validatorFileCache`) hold 
application `Class` objects and converter/validator instances. They are now 
cleared during `Dispatcher.cleanup()` together with the eight existing 
`InternalDestroyable` beans.
   
   ## Why adapters instead of a second `<bean>` line
   
   The container keys singletons by `(type, name)`, so registering the holder 
class a second time under `InternalDestroyable` builds a second, empty instance 
— `destroyInternalBeans()` would clear nothing (see the ticket for the identity 
probe). The existing dual-registered destroyables get away with it only because 
what they clear is `static`.
   
   So this adds:
   
   - `default void clearCache() {}` on `TypeConverterHolder` and 
`ActionValidatorManager` — no-op for third-party implementations, overridden in 
`StrutsTypeConverterHolder` and `DefaultActionValidatorManager` 
(`AnnotationActionValidatorManager`, the default binding, inherits it).
   - `TypeConverterHolderDestroyable` / `ActionValidatorManagerDestroyable` — 
`@Inject` the bare type, which the `StrutsBeanSelectionProvider` alias resolves 
to the singleton actually in use (a custom `struts.actionValidatorManager` / 
`struts.converter.holder` binding is covered), and call `clearCache()`.
   
   ## Tests
   
   `DispatcherCleanupTest` gains two tests that prime the caches on 
`container.getInstance(...)` — the same instance the framework injects — and 
assert they are empty after `cleanup()`. Both fail under the naive dual 
registration, which is the property the ticket asks for. Discovery test 
extended with the two new bean names. Full `core` suite: 3322 tests, 0 failures.
   
   🤖 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