Program: 189862
Project: 189862
Buggy source:
public void readEdges(XMLStreamReader reader,GraphStructure graphStructure,GraphFactoryImpl factory) throws XMLStreamException {
  TreeStructure treeStructure=graphStructure.getMainView().getStructure();
  boolean end=false;
  while (reader.hasNext() && !end) {
    int type=reader.next();
switch (type) {
case XMLStreamReader.START_ELEMENT:
      String name=reader.getLocalName();
    Integer source=0;
  Integer target=0;
Integer id=0;
Boolean directed=false;
Float weight=0f;
for (int i=0; i < reader.getAttributeCount(); i++) {
String attName=reader.getAttributeName(i).getLocalPart();
if ("String_Node_Str".equalsIgnoreCase(attName)) {
id=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
source=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
target=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
directed=Boolean.parseBoolean(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
weight=Float.parseFloat(reader.getAttributeValue(i));
}
}
AbstractNode srcNode=treeStructure.getNodeAt(source);
AbstractNode destNode=treeStructure.getNodeAt(target);
AbstractEdge edge;
if (ELEMENT_EDGES_PROPER.equalsIgnoreCase(name)) {
edge=new ProperEdgeImpl(id,srcNode,destNode);
}
 else if (ELEMENT_EDGES_MIXED.equalsIgnoreCase(name)) {
edge=new MixedEdgeImpl(id,srcNode,destNode,directed);
}
 else {
edge=new SelfLoopImpl(id,srcNode);
}
edge.setWeight(weight);
edge.getEdgeData().setAttributes(factory.newEdgeAttributes(edge.getEdgeData()));
edge.getEdgeData().setTextData(factory.newTextData());
srcNode.getEdgesOutTree().add(edge);
destNode.getEdgesInTree().add(edge);
graphStructure.addToDictionnary(edge);
break;
case XMLStreamReader.END_ELEMENT:
if (ELEMENT_EDGES.equalsIgnoreCase(reader.getLocalName())) {
end=true;
}
break;
}
}
graphStructure.getMainView().getStructureModifier().getEdgeProcessor().computeMetaEdges();
}

Fixed version (ground truth):
public void readEdges(XMLStreamReader reader,GraphStructure graphStructure,GraphFactoryImpl factory) throws XMLStreamException {
  TreeStructure treeStructure=graphStructure.getMainView().getStructure();
  boolean end=false;
  while (reader.hasNext() && !end) {
    int type=reader.next();
switch (type) {
case XMLStreamReader.START_ELEMENT:
      String name=reader.getLocalName();
    Integer source=0;
  Integer target=0;
Integer id=0;
Boolean directed=false;
Float weight=0f;
for (int i=0; i < reader.getAttributeCount(); i++) {
String attName=reader.getAttributeName(i).getLocalPart();
if ("String_Node_Str".equalsIgnoreCase(attName)) {
id=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
source=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
target=Integer.parseInt(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
directed=Boolean.parseBoolean(reader.getAttributeValue(i));
}
 else if ("String_Node_Str".equalsIgnoreCase(attName)) {
weight=Float.parseFloat(reader.getAttributeValue(i));
}
}
AbstractNode srcNode=treeStructure.getNodeAt(source);
AbstractNode destNode=treeStructure.getNodeAt(target);
AbstractEdge edge;
if (ELEMENT_EDGES_PROPER.equalsIgnoreCase(name)) {
edge=new ProperEdgeImpl(id,srcNode,destNode);
}
 else if (ELEMENT_EDGES_MIXED.equalsIgnoreCase(name)) {
edge=new MixedEdgeImpl(id,srcNode,destNode,directed);
}
 else {
edge=new SelfLoopImpl(id,srcNode);
}
edge.setWeight(weight);
edge.getEdgeData().setAttributes(factory.newEdgeAttributes(edge.getEdgeData()));
edge.getEdgeData().setId(String.valueOf(edge.getId()));
edge.getEdgeData().setTextData(factory.newTextData());
srcNode.getEdgesOutTree().add(edge);
destNode.getEdgesInTree().add(edge);
graphStructure.addToDictionnary(edge);
break;
case XMLStreamReader.END_ELEMENT:
if (ELEMENT_EDGES.equalsIgnoreCase(reader.getLocalName())) {
end=true;
}
break;
}
}
graphStructure.getMainView().getStructureModifier().getEdgeProcessor().computeMetaEdges();
}