Menu

#18 Fix bad HashMap usage when saving certain models

open
nobody
None
5
2005-03-29
2005-03-29
Anonymous
No

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

--
Max Zinal

Discussion

  • Nobody/Anonymous

    A patch for GenMMImplXMIWriterSAX2.java

     
  • Max Zinal

    Max Zinal - 2005-03-29

    Logged In: YES
    user_id=1248746

    I would also like to upload an example of model which causes
    the problem,
    but this strange tracker allows to upload only one file :(.

     
  • Nobody/Anonymous

    Logged In: NO

    Actually I've found that my implementation was pretty naive.
    I'm currently preparing a better (and, uh, much better)
    patch which *really* works with deep-nested objects along
    with multiple associations.

     
  • Max Zinal

    Max Zinal - 2005-04-01

    Logged In: YES
    user_id=1248746

    A better fix is provided in a separate patch record.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.