This is a better version of previously posted patch.
It fixes problems with processing of models which contain
multiple 'shared' and 'composite' associations on a single
aggregation class.
I've also attached an XMI file which causes the
original problem.
Speaking frankly, I do not understand how could the
original
version of NGEN process MOF and UML XMI declarations.
This is a duplicate of a report from previous patch:
Fix bad HashMap usage when saving certain models
The code generated by the current version of NGEN for
models containing cycles in associations raises
ConcurrentModificationException while saving such a
model. The problem is in the generated
processAssociations() function, which cycles through an
'extent' object, which has a type of HashMap. On some
models, this object can be modified inside the
processAssociations() function, making all iterators
invalid. Modifications are performed by the
collectAttributes() function, which is also generated
by NGEN.
My fix avoids the problem by creating a temporary copy
of 'extent' object. However, it can significantly
reduce perfomance when saving large models. Quite now I
cannot suggest a better fix.
The attached patch should be applied over file
'GenMMImplXMIWriterSAX2.java'.
An archive with patch and test case