WW-4667 Applies params to all instances of interceptor defined in stack
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f6876ce6 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f6876ce6 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f6876ce6 Branch: refs/heads/master Commit: f6876ce6ce38f037a7480c6ae9bc26991feeaefe Parents: ab0cb82 Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Tue Sep 6 09:16:54 2016 +0200 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Tue Sep 6 09:16:54 2016 +0200 ---------------------------------------------------------------------- .../xwork2/config/providers/InterceptorBuilder.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/f6876ce6/core/src/main/java/com/opensymphony/xwork2/config/providers/InterceptorBuilder.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/InterceptorBuilder.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/InterceptorBuilder.java index 04439fb..fcf2484 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/providers/InterceptorBuilder.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/InterceptorBuilder.java @@ -181,12 +181,14 @@ public class InterceptorBuilder { Interceptor interceptor = objectFactory.buildInterceptor(cfg, map); InterceptorMapping mapping = new InterceptorMapping(key, interceptor); - if (result != null && result.contains(mapping)) { - // if an existing interceptor mapping exists, - // we remove from the result Set, just to make sure - // there's always one unique mapping. - int index = result.indexOf(mapping); - result.set(index, mapping); + if (result.contains(mapping)) { + for (int index = 0; index < result.size(); index++) { + InterceptorMapping interceptorMapping = result.get(index); + if (interceptorMapping.getName().equals(key)) { + LOG.debug("Overriding interceptor config [{}] with new mapping {} using new params {}", key, interceptorMapping, map); + result.set(index, mapping); + } + } } else { result.add(mapping); }