OpenNTF / org.openntf.domino

Open replacement for lotus.domino package in HCL Domino
Apache License 2.0
65 stars 34 forks source link

ConcurrentModificationException on org.openntf.domino.graph2.annotations.AbstractIncidenceHandler.removeEdges() #148

Closed paulswithers closed 8 years ago

paulswithers commented 8 years ago

I don't think it's my implementation (though it might be), but I'm getting a java.util.ConcurrentModificationException on removeEdges(). I'm removing the Vertex at the other end of my current vertex, which is then trying to remove the edge. Here's the relevant part of the stack trace:

[err] java.util.ConcurrentModificationException [err] at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) [err] at java.util.ArrayList$Itr.next(ArrayList.java:851) [err] at org.openntf.domino.graph2.impl.DFastEdgeList$DFastEdgeIterator.next(DFastEdgeList.java:54) [err] at org.openntf.domino.graph2.impl.DFastEdgeList$DFastEdgeIterator.next(DFastEdgeList.java:1) [err] at org.openntf.domino.graph2.annotations.AbstractIncidenceHandler.removeEdges(AbstractIncidenceHandler.java:328)

removeEdges has this iterator code within it, and the error is on the first line:

    for (final Edge edge : element.getEdges(direction, label)) {
        if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
            framedGraph.removeEdge(edge);
        }
    }

I think it's failing on checking for the next edge, because it's already removed the edge it's trying to get the "next" of - is that right?

paulswithers commented 8 years ago

Adding this after line 505 of Graph2Demo also throws the same error:

            if (crew.getLastName().equals("Daniels")) {
                revengeMovie.removeStarring(crew);
            }

Tried changing it to use an iterator, but still fails.