Program: 190339
Project: 190339
Buggy source:
public void process(Workspace workspace,ContainerUnloader container){
  GraphModel graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
  this.timelineController=Lookup.getDefault().lookup(TimelineController.class);
  this.workspace=workspace;
  HierarchicalGraph graph=null;
switch (container.getEdgeDefault()) {
case DIRECTED:
    graph=graphModel.getHierarchicalDirectedGraph();
  break;
case UNDIRECTED:
graph=graphModel.getHierarchicalUndirectedGraph();
break;
case MIXED:
graph=graphModel.getHierarchicalMixedGraph();
break;
default :
graph=graphModel.getHierarchicalMixedGraph();
break;
}
GraphFactory factory=graphModel.factory();
AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
attributeModel.mergeModel(container.getAttributeModel());
Map<String,Node> map=new HashMap<String,Node>();
for (Node n : graph.getNodes()) {
Object id=n.getNodeData().getAttributes().getValue(PropertiesColumn.NODE_ID.getIndex());
if (id != null) {
map.put((String)id,n);
}
if (n.getNodeData().getLabel() != null && !n.getNodeData().getLabel().isEmpty()) {
map.put(n.getNodeData().getLabel(),n);
}
}
int nodeCount=0;
for (NodeDraftGetter draftNode : container.getNodes()) {
Node n;
String id=draftNode.getId();
if (id != null && map.get(id) != null) {
n=map.get(id);
}
 else {
n=factory.newNode();
}
flushToNode(draftNode,n);
draftNode.setNode(n);
nodeCount++;
}
for (NodeDraftGetter draftNode : container.getNodes()) {
Node n=draftNode.getNode();
NodeDraftGetter[] parents=draftNode.getParents();
if (parents != null) {
for (int i=0; i < parents.length; i++) {
Node parent=parents[i].getNode();
graph.addNode(n,parent);
}
}
 else {
graph.addNode(n);
}
}
int edgeCount=0;
for (EdgeDraftGetter edge : container.getEdges()) {
Node source=edge.getSource().getNode();
Node target=edge.getTarget().getNode();
Edge e=null;
switch (container.getEdgeDefault()) {
case DIRECTED:
e=factory.newEdge(source,target,edge.getWeight(),true);
break;
case UNDIRECTED:
e=factory.newEdge(source,target,edge.getWeight(),false);
break;
case MIXED:
e=factory.newEdge(source,target,edge.getWeight(),edge.getType().equals(EdgeType.UNDIRECTED) ? false : true);
break;
}
flushToEdge(edge,e);
edgeCount++;
graph.addEdge(e);
}
System.out.println("String_Node_Str" + nodeCount + "String_Node_Str"+ edgeCount);
timelineController=null;
workspace=null;
}

Fixed version (ground truth):
public void process(Workspace workspace,ContainerUnloader container){
  GraphModel graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
  this.timelineController=Lookup.getDefault().lookup(TimelineController.class);
  this.workspace=workspace;
  HierarchicalGraph graph=null;
switch (container.getEdgeDefault()) {
case DIRECTED:
    graph=graphModel.getHierarchicalDirectedGraph();
  break;
case UNDIRECTED:
graph=graphModel.getHierarchicalUndirectedGraph();
break;
case MIXED:
graph=graphModel.getHierarchicalMixedGraph();
break;
default :
graph=graphModel.getHierarchicalMixedGraph();
break;
}
GraphFactory factory=graphModel.factory();
if (timelineController != null) {
timelineController.setMin(workspace,container.getTimeIntervalMin());
timelineController.setMax(workspace,container.getTimeIntervalMax());
}
AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
attributeModel.mergeModel(container.getAttributeModel());
Map<String,Node> map=new HashMap<String,Node>();
for (Node n : graph.getNodes()) {
Object id=n.getNodeData().getAttributes().getValue(PropertiesColumn.NODE_ID.getIndex());
if (id != null) {
map.put((String)id,n);
}
if (n.getNodeData().getLabel() != null && !n.getNodeData().getLabel().isEmpty()) {
map.put(n.getNodeData().getLabel(),n);
}
}
int nodeCount=0;
for (NodeDraftGetter draftNode : container.getNodes()) {
Node n;
String id=draftNode.getId();
if (id != null && map.get(id) != null) {
n=map.get(id);
}
 else {
n=factory.newNode();
}
flushToNode(draftNode,n);
draftNode.setNode(n);
nodeCount++;
}
for (NodeDraftGetter draftNode : container.getNodes()) {
Node n=draftNode.getNode();
NodeDraftGetter[] parents=draftNode.getParents();
if (parents != null) {
for (int i=0; i < parents.length; i++) {
Node parent=parents[i].getNode();
graph.addNode(n,parent);
}
}
 else {
graph.addNode(n);
}
}
int edgeCount=0;
for (EdgeDraftGetter edge : container.getEdges()) {
Node source=edge.getSource().getNode();
Node target=edge.getTarget().getNode();
Edge e=null;
switch (container.getEdgeDefault()) {
case DIRECTED:
e=factory.newEdge(source,target,edge.getWeight(),true);
break;
case UNDIRECTED:
e=factory.newEdge(source,target,edge.getWeight(),false);
break;
case MIXED:
e=factory.newEdge(source,target,edge.getWeight(),edge.getType().equals(EdgeType.UNDIRECTED) ? false : true);
break;
}
flushToEdge(edge,e);
edgeCount++;
graph.addEdge(e);
}
System.out.println("String_Node_Str" + nodeCount + "String_Node_Str"+ edgeCount);
timelineController=null;
workspace=null;
}