[hibernate-issues] [Hibernate-JIRA] Created: (ANN-511) Two level @Valid annotation doesn't work

Rakesh Kalra (JIRA) noreply at atlassian.com
Wed Dec 20 18:30:04 EST 2006


Two level @Valid annotation doesn't work 
-----------------------------------------

         Key: ANN-511
         URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-511
     Project: Hibernate Annotations
        Type: Bug

  Components: validator  
    Versions: 3.2.1    
 Environment: hibernate-annotations 3.2.1.ga

    Reporter: Rakesh Kalra


I have object depth of 3: Form, Member, Address. I get the following exception when initializing ClassValidator:

java.lang.NullPointerException
        at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:142)
        at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
        at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
        at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:149)
        at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
        at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
        at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:134)
        at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
        at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
        ...

This works fine with 3.2.0.ga.

I think the problem is in the following constructor, where instance level "reflectionManager" is not being initialized.

	protected ClassValidator(
			XClass beanXClass, ResourceBundle resourceBundle, MessageInterpolator userInterpolator,
			Map<XClass, ClassValidator> childClassValidators, ReflectionManager reflectionManager
	) {
		this.beanClass = reflectionManager.toClass( beanXClass );
		this.messageBundle = resourceBundle == null ?
				getDefaultResourceBundle() :
				resourceBundle;
		this.defaultMessageBundle = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE );
		this.userInterpolator = userInterpolator;
		this.childClassValidators = childClassValidators;
		initValidator( beanXClass, childClassValidators );
	}

The other constructor initializes reflectionManager.


-- 
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