Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 509078

Summary: The GraphCopier does not copy edges correctly when copying a graph that contains nested graphs.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF GraphAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.0.1   
Target Milestone: 5.0.0 (Oxygen) M4   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2016-12-12 08:36:10 EST
Due to an internal flaw within GraphCopier, edges are not correctly copied if the source graph contains a nested graph. When a graph is copied, the internal fields "inputToOutputNodes" and "inputToOutputEdges" are cleared. However, the same method that clears these fields is used to copy a graph, therefore, if a nested graph is copied, these fields are cleared. As the fields are used to determine the source and target nodes for edges, the copied edges will not have source and target nodes if a nested graph was previously copied.

The public method GraphCopier#copy(Graph) should clear the fields and then delegate to another method #doCopy(Graph) that does not clear the fields.
Comment 1 Matthias Wienand CLA 2016-12-12 11:03:02 EST
I added a protected method GraphCopier#copyGraph(Graph) that does not clear the internal fields. The public method #copy(Graph) clears the fields and delegates to #copyGraph(Graph). The #copyNode(Node) method also delegates to #copyGraph(Graph) so that the fields are not cleared when a nested graph is copied. The code is published on the master branch, therefore, I resolve this ticket as fixed for 5.0.0 M4.