]
Hardy Ferentschik reassigned HV-430:
------------------------------------
Assignee: Hardy Ferentschik
XML configuration does not allow configuration of public fields in
superclass
-----------------------------------------------------------------------------
Key: HV-430
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-430
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Beta1
Reporter: Hardy Ferentschik
Assignee: Hardy Ferentschik
Fix For: 4.2.0.Beta2
The following will not work at the moment, even though the field _foo_ is public in class
_A_. You will get an exception:
{noformat}
javax.validation.ValidationException: org.hibernate.validator.test.xml.B does not contain
the fieldType foo
{noformat}
{code}
public class A {
public int foo;
public int getFoo() {
return foo;
}
public void setFoo(int foo) {
this.foo = foo;
}
}
{code}
{code}
public class B extends A {
}
{code}
{code}
<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>org.hibernate.validator.xml</default-package>
<bean class="org.hibernate.validator.test.xml.A"
ignore-annotations="true">
<field name="foo">
<constraint annotation="javax.validation.constraints.Min">
<element name="value">1</element>
</constraint>
</field>
</bean>
</constraint-mappings>
{code}
{code}
<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>org.hibernate.validator.xml</default-package>
<bean class="org.hibernate.validator.test.xml.B"
ignore-annotations="true">
<field name="foo">
<constraint annotation="javax.validation.constraints.Min">
<element name="value">18</element>
</constraint>
</field>
</bean>
</constraint-mappings>
{code}
The problem is that XMLMappingParser uses {{Class.getDeclaredField}} instead of
{{Class.getField}} to check whether a field exists. Easy to fix, but need to check against
the BV spec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: