diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java index 24df16995..de99148d1 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java @@ -273,9 +273,6 @@ public class ParametersInterceptor extends MethodFilterInterceptor { } protected void setParameters(Object action, ValueStack stack, final Map parameters) { - ParameterNameAware parameterNameAware = (action instanceof ParameterNameAware) - ? (ParameterNameAware) action : null; - Map params; Map acceptableParameters; if (ordered) { @@ -289,11 +286,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor { for (Map.Entry entry : params.entrySet()) { String name = entry.getKey(); - - boolean acceptableName = acceptableName(name) - || (parameterNameAware != null && parameterNameAware.acceptableParameterName(name)); - - if (acceptableName) { + if (isAcceptableParameter(name, action)) { acceptableParameters.put(name, entry.getValue()); } } @@ -346,6 +339,18 @@ public class ParametersInterceptor extends MethodFilterInterceptor { addParametersToContext(ActionContext.getContext(), acceptableParameters); } + /** + * Checks if name of parameter can be accepted or thrown away + * + * @param name parameter name + * @param action current action + * @return true if parameter is accepted + */ + protected boolean isAcceptableParameter(String name, Object action) { + ParameterNameAware parameterNameAware = (action instanceof ParameterNameAware) ? (ParameterNameAware) action : null; + return acceptableName(name) || (parameterNameAware != null && parameterNameAware.acceptableParameterName(name)); + } + /** * Gets an instance of the comparator to use for the ordered sorting. Override this * method to customize the ordering of the parameters as they are set to the