[hibernate-issues] [Hibernate-JIRA] Commented: (HV-263) NullPointerException when no constraint in xml

Michenaud Laurent (JIRA) noreply at atlassian.com
Wed Oct 28 12:50:13 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34330#action_34330 ] 

Michenaud Laurent commented on HV-263:
--------------------------------------

It works if you indicates the bean implementation in the xml configuration.
Try making an interface on your test bean if it doesnot have one, and
use the interface in the xml configuration.



> NullPointerException when no constraint in xml
> ----------------------------------------------
>
>                 Key: HV-263
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-263
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: mapping
>    Affects Versions: 4.0.1
>         Environment: Linux
>            Reporter: Michenaud Laurent
>             Fix For: 4.1.0
>
>
> In xml configuration, if you declare a bean with no constraint, a
> nullpointer exception occurs at validation.
> Configuration :
> <constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping 
> 	validation-mapping-1.0.xsd"
> 	xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
> 	<default-package>org.mypackage</default-package>
> 	<bean class="Intervention" ignore-annotations="true">
>         </bean>
> </constraint-mappings>
> Error at validation :
> Exception in thread "main" java.lang.NullPointerException
> 	at org.hibernate.validator.metadata.BeanMetaDataImpl.initClassConstraints(BeanMetaDataImpl.java:417)
> 	at org.hibernate.validator.metadata.BeanMetaDataImpl.initClass(BeanMetaDataImpl.java:243)
> 	at org.hibernate.validator.metadata.BeanMetaDataImpl.createMetaData(BeanMetaDataImpl.java:238)
> 	at org.hibernate.validator.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:117)
> 	at org.hibernate.validator.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:110)
> 	at org.hibernate.validator.engine.ValidatorImpl.getBeanMetaData(ValidatorImpl.java:735)
> 	at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:202)
> 	at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
> 	at com.adeuza.movalys.validation.hibernate.TestMain.main(TestMain.java:71)

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