Issue Type: Bug Bug
Affects Versions: 4.3.0.Final, 4.2.0.Final
Assignee: Unassigned
Created: 24/Oct/12 7:37 AM
Description:

The code seems to assume that all methods which are named getX/setX are bean properties - even when they don't match the required constraints for a bean (i.e. no arg getter, single arg setter).

When using method validation, hibernate validator errors with a "wrong number of arguments" when it encounters annotated methods of this type which don't match the bean constraints.

The property detection should follow the JavaBeans specification.

public interface MyService {
  @NotNull String getGreeting(@NotNull String greetee);
}

public class MyServiceImpl implements MyService {
  @NotNull String greeting;

  public void setGreeting(String greeting) {
    this.greeting = greeting;
  }

  public String getGreeting(String greetee) {
    return greeting + " " + greetee;
  }
}

public class TestCase {
  public static void main(String[] args) {
    MyService myService = new MyServiceImpl(); 
    myService.setGreeting("Hello");
    Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    validator.validate(myService); // throws IllegalArgumentException - wrong number of arguments
  }
}
Project: Hibernate Validator
Priority: Major Major
Reporter: Dale Peakall
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