Page 1 of 1

copy existing row in existing table with XmlUtils.deepCopy

PostPosted: Wed Nov 15, 2017 12:08 am
by shaolinmaster
when adding a new row in an existing table with one row
like this:
Tr workingRow = (Tr) XmlUtils.deepCopy(existingRow);
tbl.getContent().add(workingRow);

and then:
tableElement.getContent().remove(existingRow);
everything works fine.

But if I don't remove the existingRow or add more rows then I have a java.util.ConcurrentModificationException.
Can you help me please?

Re: copy existing row in existing table with XmlUtils.deepCo

PostPosted: Wed Nov 15, 2017 7:49 pm
by jason
You just need to respect Java's standard rules/idiosyncrasies when manipulating lists (eg deleting while iterating).

If you are identifying objects for deletion inside a for, put these in a second list, then, outside the for, delete them.

Hope this helps. If you need more help, you'll need to provide some executable code.