]
Gunnar Morling resolved HV-524.
-------------------------------
Resolution: Fixed
Applied pull request
java.util.NoSuchElementException in type level validation using
EclipseLink
---------------------------------------------------------------------------
Key: HV-524
URL:
https://hibernate.onjira.com/browse/HV-524
Project: Hibernate Validator
Issue Type: Bug
Components: validators
Affects Versions: 4.2.0.Final
Environment: EclipseLink 2.2.0
Reporter: sinuhepop
Assignee: Hardy Ferentschik
Fix For: 4.3.0.Alpha1
Attachments: HV-524.zip, logShowingProblem.txt
When EclipseLink obtains an entity from database, it does a validation. It works ok with
field level validators, but throws an exception with type level ones.
The problem is that _SingleThreadCachedTraversableResolver_ sends an "empty"
_pathToTraversableObject_ to EL's BeanValidationListener, who finally fails when
calling
{code}
pathToTraversableObject.iterator().next().getName()
{code}
I don't know who (HV or EL) is responsible of the issue, but it worked with
HV-4.0.2.GA.
Thanks for your effort.
Sinuhé.
{noformat}
Caused by: javax.validation.ValidationException: Call to
TraversableResolver.isReachable() threw an exception
at
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1251)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:448)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:397)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:361)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:313)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:139)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.validateOnCallbackEvent(BeanValidationListener.java:84)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.preUpdate(BeanValidationListener.java:72)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:671)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.descriptors.DescriptorEventManager.notifyEJB30Listeners(DescriptorEventManager.java:641)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:200)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:85)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChangesForExistingObject(DeferredChangeDetectionPolicy.java:54)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:623)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1496)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:264)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1130)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
... 73 common frames omitted
Caused by: java.util.NoSuchElementException: null
at java.util.Collections$EmptyIterator.next(Unknown Source) ~[na:1.7.0]
at
org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener$AutomaticLifeCycleValidationTraversableResolver.isRootObjectPath(BeanValidationListener.java:180)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener$AutomaticLifeCycleValidationTraversableResolver.isReachable(BeanValidationListener.java:123)
~[eclipselink-2.2.0.jar:2.2.0.v20110202-r8913]
at
org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:46)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
at
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1242)
~[hibernate-validator-4.2.0.Final.jar:4.2.0.Final]
... 90 common frames omitted
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: