Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[Texo] "clear list" feature causes ConcurrentModificationException
https://www.eclipse.org/forums/index.php/mv/msg/262116/756811/#msg_756811
don't know if I am using the latest Texo version (downloaded it approx. 1 month ago).
Will have a look at it.
So maybe this is already fixed.
The issue:
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
while (!XYZs.isEmpty()) {
removeXYZ(XYZs.get(0));
}
Keep on the good work.
Thanks a lot for this tool and regards,
Roland]]>R. Oldenburg2011-11-15T08:56:34-00:00Re: [Texo] &quot;clear list&quot; feature causes ConcurrentModificationException
https://www.eclipse.org/forums/index.php/mv/msg/262116/756863/#msg_756863
Seems indeed like a bug, can you enter a bugzilla on Texo? https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT&component=Texo&version=0.5
with the same description/text then I will pick it up.
gr. Martin
On 11/15/2011 09:56 AM, R. Oldenburg wrote:
> Hi,
>
> don't know if I am using the latest Texo version (downloaded it approx. 1 month ago).
> Will have a look at it.
>
> So maybe this is already fixed.
>
> The issue:
> 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
> while (!XYZs.isEmpty()) {
> removeXYZ(XYZs.get(0));
> }
>
> Keep on the good work.
> Thanks a lot for this tool and regards,
> Roland