| Summary: | [Texo] "clear list" feature causes ConcurrentModificationException | ||
|---|---|---|---|
| Product: | [Modeling] EMFT | Reporter: | R. Oldenburg <roland.oldenburg> |
| Component: | Texo | Assignee: | Martin Taal <mtaal> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 0.5 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I have changed the code generation and added a testcase. So this should now be solved. I published a new build containing these issues. Please re-open this issue if it is still encountered. gr. Martin |
When generating bi-directional support for a ordered 1:n-relation then there are some generated features handling the changes that need to be applied to the "n"-list. The method "clearXYZ" seems to be generated incorrectly as it: - iterates over the list with an foreach (for XYZ xyz : XYZs) - and calls "removeXYZ" for every entry (which handles the bi-directional remove) This consequently leads to an ConcurrentModificationException because the list ( which it currently iterates on) is being modified (entries are removed). Imo there are two possible solutions: - Iterate over a copy of the org. list (i.e. for (XYZ xyz : new ArrayList<XYZ>(XYZs)) or - simply remove the first entry from the list until it is empty Code: [Select all] [Show/ hide] while (!XYZs.isEmpty()) { removeXYZ(XYZs.get(0)); }