[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-146) ConstraintValidator impls cannot inherit from a super class implementing ConstraintValidator
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Mon May 4 13:06:17 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bernard resolved HV-146.
---------------------------------
Resolution: Fixed
> ConstraintValidator impls cannot inherit from a super class implementing ConstraintValidator
> --------------------------------------------------------------------------------------------
>
> Key: HV-146
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-146
> Project: Hibernate Validator
> Issue Type: Bug
> Components: engine
> Affects Versions: 4.0.0.Alpha3
> Reporter: Eddy Verbruggen
> Fix For: 4.0.0.Beta2
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> My Validator classes extend a common superclass, which in turn implements the ConstraintValidator interface. This version of Hibernate Validator can't cope with that class structure due to a little bug in ValidatorTypeHelper.resolveTypes.
> The last bit of that method calls itself recursively, but ignores returnvalues, so the code always falls through to "return null".
> else {
> resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
> for ( Type genericInterface : rawType.getGenericInterfaces() ) {
> resolveTypes( resolvedTypes, genericInterface );
> }
> }
> }
> //else we don't care I think
> return null;
> Can it be changed to something like this please:
> else {
> Type returnedType = resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
> if ( returnedType != null ) {
> return returnedType;
> }
> for ( Type genericInterface : rawType.getGenericInterfaces() ) {
> returnedType = resolveTypes( resolvedTypes, genericInterface );
> if ( returnedType != null ) {
> return returnedType;
> }
> }
> }
> }
> //else we don't care I think
> return null;
> The stacktrace is:
> java.lang.NullPointerException
> at org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68)
> at org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57)
> at org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163)
> at org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144)
> at org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113)
> at org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126)
> at org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419)
> at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373)
> at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list