[
https://issues.apache.org/jira/browse/WW-3753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13205975#comment-13205975
]
Rees Byars commented on WW-3753:
--------------------------------
Ok, so the patch consists of two parts:
1) The buildValidatorKey() has been changed to accept the context as a
parameter again. Now, instead of always using config.getName() in place of the
context name (as implemented per WW-2996 to correct memory leaks for wil card
actions), the config name is used in place of the context only if it contains
the wild card character. In this way, the flexibility of the original design
is maintained while also accounting for the memory leaks.
2) A getValidationContext() method has been added to the
ValidationInterceptor. This method as it is implemented performs the same
proxy.getActionName() call to create the context as is currently used.
Extracting this function into a separate method allows for a useful bit of
flexibility in that the method can be overridden to provide custom contexts.
As well, the buildValidaterKey() test was changed to pass for the standard use
case, but it still needs to have an assertion added for the wild card case.
> The AnnotationActionValidatorManager does not adhere to the
> ActionValidatorManager interface's contract
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-3753
> URL: https://issues.apache.org/jira/browse/WW-3753
> Project: Struts 2
> Issue Type: Bug
> Reporter: Rees Byars
> Priority: Minor
> Attachments: ww3753_patch
>
>
> An ActionValidatorManager accepts a java.util.String "context" parameter for
> identifying the appropriate configurations. In the
> AnnotationActionValidatorManager's buildValidatorKey() method, however,
> "config.getName()" is used instead of the passed-in context. This violates
> the contract of the interface and tightly couples the
> AnnotationActionValidatorManager to the ValidationInterceptor.
> I have a situation whereby I have created my own validation interceptor for a
> special case that passes in a context not derived from
> "proxy.getActionName()" (equivalent to config.getName() except for in the
> case of wildcards), only to find that this context isn't used properly by the
> manager. I then created my own manager, changing only the
> buildValidatorKey() to use the given context, and it works well.
> Either the ActionValidatorManager should be changed to no longer accept a
> context parameter and handle the context itself in every case (which seems to
> not be the best solution), or the AnnotationActionValidatorManager should be
> changed to use the given context in every case. The ValidationInterceptor
> will need a small change as well in this case to maintain the functionality
> of WW-3194 without reintroducing the memory leaks from WW-2996.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira