Issue Type: Bug Bug
Affects Versions: 5.0.0.Alpha2
Assignee: Unassigned
Components: engine
Created: 11/Dec/12 9:39 AM
Description:

ParameterNameProvider:

public class CustomParameterNameProvider implements ParameterNameProvider {

        private final ParameterNameProvider nameProvider;

        public CustomParameterNameProvider() {
            nameProvider = Validation.byDefaultProvider().configure().getDefaultParameterNameProvider();
        }

        @Override
        public String[] getParameterNames(final Constructor<?> constructor) {
            return nameProvider.getParameterNames(constructor);
        }

        @Override
        public String[] getParameterNames(final Method method) {
            try {
                final Method post = CustomConfigResource.class.getMethod("post", String.class, CustomBean.class);
                if (method.equals(post)) {
                    return new String[] {"path", "beanParameter"};
                }
            } catch (NoSuchMethodException e) {
                // Do nothing.
            }
            return nameProvider.getParameterNames(method);
        }
    }

Test:

Validation.buildDefaultValidatorFactory().usingContext().parameterNameProvider(new CustomParameterNameProvider()).getValidator().forMethods().validateParameters(...);

This invocation returns ConstraintViolation where parameter names are arg0/arg1 instead of custom values defined by custom ParameterNameProvider. Basically, if you open ValidatorContextImpl class in an IDE you can see that parameterNameProvider is assigned but never accessed.

Project: Hibernate Validator
Priority: Major Major
Reporter: Michal Gajdos
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira