Project

General

Profile

Revision c7b20ed3

IDc7b20ed3c866508182a3d5d1b44b57fc1244b6f8
Parent 2bc033c4
Child 0656435d

Added by Patrick Plitzner about 1 year ago

fix #7665 Use iterator to avoid ConcurrentModificationException

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmFormElement.java
5 5

  
6 6
import java.util.ConcurrentModificationException;
7 7
import java.util.HashSet;
8
import java.util.Iterator;
8 9
import java.util.List;
9 10
import java.util.Set;
10 11

  
......
144 145
	 */
145 146
	@Override
146 147
    public void removeElements(){
147
		for(ICdmFormElement childElement : getElements()){
148
        for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
149
            ICdmFormElement childElement = iterator.next();
148 150
			// recursion
149 151
			childElement.removeElements();
150 152

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
5 5

  
6 6
import java.util.ConcurrentModificationException;
7 7
import java.util.HashSet;
8
import java.util.Iterator;
8 9
import java.util.List;
9 10
import java.util.Set;
10 11

  
......
419 420
	 */
420 421
	@Override
421 422
    public void removeElements() {
422
		for (ICdmFormElement childElement : getElements()) {
423
		for (Iterator<ICdmFormElement> formElementIterator = getElements().iterator();formElementIterator.hasNext();) {
424
		    ICdmFormElement childElement = formElementIterator.next();
423 425
			// recursion
424 426
			childElement.removeElements();
425 427

  
......
436 438
			formFactory.removePropertyChangeListener(childElement);
437 439

  
438 440
			// dispose of the controls
439
			for (Control control : childElement.getControls()) {
441
			for (Iterator<Control> controlIterator = childElement.getControls().iterator();controlIterator.hasNext();) {
442
			    Control control = controlIterator.next();
440 443
				// we added the layoutComposite of the parental element as the
441 444
				// layout composite to this formElement
442 445
				// but we do not want to destroy it.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)