Skip to content

Commit

Permalink
Minor fix (fix concurrent exception on map remove)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleroux-keep committed Jan 2, 2017
1 parent 514d28e commit 8f1053d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/org/roda/rodain/rules/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
Expand Down Expand Up @@ -282,11 +283,14 @@ public void update(Observable o, Object arg) {
sipNodes.remove(sip.getId());
sips.remove(sip.getId());
setChanged();

schemaNodes.forEach(schemaNode -> {
if (schemaNode.isRemoved())
schemaNodes.remove(schemaNode);
});

Iterator<SchemaNode> iter = schemaNodes.iterator();
while (iter.hasNext()) {
if(iter.next().isRemoved()){
iter.remove();
}
}

if (sips.isEmpty() && schemaNodes.isEmpty()) {
notifyObservers("Removed rule");
} else
Expand Down

0 comments on commit 8f1053d

Please sign in to comment.