[
http://opensource.atlassian.com/projects/hibernate/browse/HV-252?page=com...
]
Ed Burns commented on HV-252:
-----------------------------
I checked out the XML parsing and it seemed to be ok. It was building the metadata
correctly as far as I can tell.
However, I see that BeanMetadataImpl does not have "listOfString" in the
propertyNames ivar. Instead, it has "class" and "hCode".
HV with XML config tells me "Invalid property path." even
though I know there is such a property.
-------------------------------------------------------------------------------------------------
Key: HV-252
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-252
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.0.0.GA
Environment: Java 6 on Mac OSX 10.5.8
Reporter: Ed Burns
Attachments: integration-test-servlet.war
Original Estimate: 1 week
Remaining Estimate: 1 week
I will attach a test war, but here is a summary of the problem. I am configuring my BV
with the following XML
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<constraint-mappings
xmlns=\"http://jboss.org/xml/ns/javax/validation/mapping\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/mapping
validation-mapping-1.0.xsd\">
<default-package>integration_test_servlet</default-package>
<bean class=\"Person\" ignore-annotations=\"true\">
<field name=\"firstName\"
ignore-annotations=\"true\">
<constraint
annotation=\"javax.validation.constraints.NotNull\" />
</field>
<field name=\"lastName\"
ignore-annotations=\"true\">
<constraint
annotation=\"javax.validation.constraints.NotNull\" />
</field>
<getter name=\"listOfString\"
ignore-annotations=\"true\">
<constraint
annotation=\"javax.validation.constraints.NotNull\" />
</getter>
</bean>
</constraint-mappings>
My POJO looks like this:
package integration_test_servlet;
import java.util.List;
import javax.validation.constraints.NotNull;
public class Person {
@NotNull
private String firstName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@NotNull
private String lastName;
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
private List<String> listOfString;
@NotNull
public List<String> getListOfString() {
return listOfString;
}
public void setListOfString(List<String> listOfString) {
this.listOfString = listOfString;
}
}
And I'm trying to validate like this:
List<String> listOfString = new ArrayList<String>();
listOfString.add("one");
listOfString.add("two");
listOfString.add("three");
Set<ConstraintViolation<Person>> violations =
beanValidator.validateValue(Person.class, "listOfString",
listOfString);
But this causes the following exception:
java.lang.IllegalArgumentException: Invalid property path. There is no property
listOfString in entity integration_test_servlet.Person
The same test, but with no XML configuration, relying instead on the Annotations, works
ok.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira