[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7081) "Second pass" information can get lost during configuration if a component has a nested component, leading to ConcurrentModificationException during configuration.

Philip Newton (JIRA) noreply at atlassian.com
Sat Feb 18 11:01:12 EST 2012


"Second pass" information can get lost during configuration if a component has a nested component, leading to ConcurrentModificationException during configuration.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-7081
                 URL: https://hibernate.onjira.com/browse/HHH-7081
             Project: Hibernate ORM
          Issue Type: Bug
          Components: annotations, core
    Affects Versions: 3.6.8
            Reporter: Philip Newton


I have an environment with an entity A which contains a map of components/elements B. Each B has a component C which refers (many-to-one) to an entity D.

During configuration and second-pass compile, I get this call sequence:

Configuration.originalSecondPassCompile at line 1716 calls MapBinder$1(CollectionSecondPass).doSecondPass

doSecondPass at line 65 calls MapBinder$1.secondPass

secondPass at line 113 calls MapBinder(CollectionBinder).bindStarToManySecondPass

bindStarToManySecondPass at line 710 calls MapBinder(CollectionBinder).bindManyToManySecondPass

bindManyToManySecondpass at line 1380 calls AnnotationBinder.fillComponent with parameter inSecondPass := true

fillComponent at line 2336 calls AnnotationBinder.fillComponent and passes on inSecondPass := true

fillComponent at line 2433 calls AnnotationBinder.processElementAnnotations and passes on inSecondPass := true

processElementAnnotations at line 2021 calls AnnotationBinder.bindComponent ----------> the "inSecondPass" information is lost here!

bindComponent at line 2285 calls AnnotationBinder.fillComponent with parameter inSecondPass := false

fillComponent at line 2336 calls AnnotationBinder.fillComponent

fillComponent at line 2433 calls AnnotationBinder.processElementAnnotations

processElementAnnotations at line 1600 calls AnnotationBinder.bindManyToOne

bindManyToOne at line 2695 checks the value of "inSecondPass", which should be true but is false here due to the value being lost in the call to bindComponent above.

It then adds an "FkSecondPass" object with mappings.addSecondPass.

When that whole call stack returns to Configuration.originalSecondPassCompile, the call to itr.hasNext() crashes with a ConcurrentModificationException, because the list of second pass items was modified during iteration.

If nested components are allowed and if such nested components are allowed to have references to entities, then the "inSecondPass" information may not get lost when the nested component is bound!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list