Program: 13033
Project: 13033
Buggy source:
public List<GraphmlEdge> getEdgesToNeighbours(){
  List<GraphmlEdge> graphmlEdges=new ArrayList<>();
  Set<Subnet> subnetSet=device.getDeviceSubnetsFromActiveInterfaces();
  for (  DiscoveredInterface devInterface : device.getInterfaceList()) {
    String localMac=devInterface.getParams().get("String_Node_Str");
    for (    DeviceNeighbour deviceNeighbour : devInterface.getNeighbours()) {
      String neighbourIpAddress=deviceNeighbour.getNeighbourIpAddress();
      String neighbourHostName=deviceNeighbour.getNeighbourHostName();
      String neighbourMac=deviceNeighbour.getNeighbourMac();
      String neighbourId=getNeighbourIdFromAliases(neighbourHostName,neighbourIpAddress,neighbourMac);
      if (neighbourId == null)       continue;
      boolean neighbourInSubnet=false;
      if (neighbourIpAddress != null && !neighbourIpAddress.isEmpty()) {
        for (        Subnet subnet : subnetSet) {
          if (subnet.contains(neighbourIpAddress)) {
            EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,subnet.getName(),neighbourIpAddress,subnet.getIpAddress());
            GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
            graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
            boolean edgeAlreadyDefined=false;
            for (            GraphmlEdge edge : graphmlEdges) {
              if (edge.getId().equals(graphmlEdge.getId())) {
                edgeAlreadyDefined=true;
                int index=graphmlEdges.indexOf(edge);
                logger.info(graphmlEdge + "String_Node_Str");
                List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
                List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
                edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
                graphmlEdges.set(index,edge);
              }
            }
            if (!edgeAlreadyDefined) {
              graphmlEdges.add(graphmlEdge);
            }
            neighbourInSubnet=true;
            break;
          }
        }
      }
      if (!neighbourInSubnet) {
        EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,node.getId(),neighbourId,node.getId(),localMac,neighbourMac);
        GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
        graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
        boolean edgeAlreadyDefined=false;
        for (        GraphmlEdge edge : graphmlEdges) {
          if (edge.getId().equals(graphmlEdge.getId())) {
            edgeAlreadyDefined=true;
            int index=graphmlEdges.indexOf(edge);
            logger.info(graphmlEdge + "String_Node_Str");
            List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
            List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
            edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
            graphmlEdges.set(index,edge);
          }
        }
        if (!edgeAlreadyDefined) {
          graphmlEdges.add(graphmlEdge);
        }
      }
    }
  }
  for (  DeviceNeighbour deviceNeighbour : device.getLogicalDeviceData().getDeviceNeighbourList()) {
    String neighbourIpAddress=deviceNeighbour.getNeighbourIpAddress();
    String neighbourHostName=deviceNeighbour.getNeighbourHostName();
    String neighbourMac=deviceNeighbour.getNeighbourMac();
    String neighbourId=getNeighbourIdFromAliases(neighbourHostName,neighbourIpAddress,neighbourMac);
    if (neighbourId == null)     continue;
    boolean neighbourInSubnet=false;
    if (neighbourIpAddress != null && !neighbourIpAddress.isEmpty()) {
      for (      Subnet subnet : subnetSet) {
        if (subnet.contains(neighbourIpAddress)) {
          EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,subnet.getName(),neighbourIpAddress,subnet.getIpAddress());
          GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
          graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
          boolean edgeAlreadyDefined=false;
          for (          GraphmlEdge edge : graphmlEdges) {
            if (edge.getId().equals(graphmlEdge.getId())) {
              edgeAlreadyDefined=true;
              int index=graphmlEdges.indexOf(edge);
              logger.info(graphmlEdge + "String_Node_Str");
              List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
              List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
              edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
              graphmlEdges.set(index,edge);
            }
          }
          if (!edgeAlreadyDefined) {
            graphmlEdges.add(graphmlEdge);
          }
          neighbourInSubnet=true;
          break;
        }
      }
    }
    if (!neighbourInSubnet) {
      EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,node.getId(),neighbourId,node.getId());
      GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
      graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
      boolean edgeAlreadyDefined=false;
      for (      GraphmlEdge edge : graphmlEdges) {
        if (edge.getId().equals(graphmlEdge.getId())) {
          edgeAlreadyDefined=true;
          int index=graphmlEdges.indexOf(edge);
          logger.info(graphmlEdge + "String_Node_Str");
          edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(edge.getGraphmlEdgeDataList(),graphmlEdge.getGraphmlEdgeDataList())));
          graphmlEdges.set(index,edge);
        }
      }
      if (!edgeAlreadyDefined) {
        graphmlEdges.add(graphmlEdge);
      }
    }
  }
  return graphmlEdges;
}

Fixed version (ground truth):
public List<GraphmlEdge> getEdgesToNeighbours(){
  List<GraphmlEdge> graphmlEdges=new ArrayList<>();
  Set<Subnet> subnetSet=device.getDeviceSubnetsFromActiveInterfaces();
  for (  DiscoveredInterface devInterface : device.getInterfaceList()) {
    String localMac=devInterface.getParams().get("String_Node_Str");
    for (    DeviceNeighbour deviceNeighbour : devInterface.getNeighbours()) {
      String neighbourIpAddress=deviceNeighbour.getNeighbourIpAddress();
      String neighbourHostName=deviceNeighbour.getNeighbourHostName();
      String neighbourMac=deviceNeighbour.getNeighbourMac();
      AliasResolver aliasResolver=new AliasResolver(node,neighbourHostName,neighbourIpAddress,neighbourMac);
      String neighbourId=aliasResolver.getNeighbourIdFromAliases();
      if (neighbourId == null)       continue;
      boolean neighbourInSubnet=false;
      if (neighbourIpAddress != null && !neighbourIpAddress.isEmpty()) {
        for (        Subnet subnet : subnetSet) {
          if (subnet.contains(neighbourIpAddress)) {
            EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,subnet.getName(),neighbourIpAddress,subnet.getIpAddress());
            GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
            graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
            boolean edgeAlreadyDefined=false;
            for (            GraphmlEdge edge : graphmlEdges) {
              if (edge.getId().equals(graphmlEdge.getId())) {
                edgeAlreadyDefined=true;
                int index=graphmlEdges.indexOf(edge);
                logger.info(graphmlEdge + "String_Node_Str");
                List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
                List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
                edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
                graphmlEdges.set(index,edge);
              }
            }
            if (!edgeAlreadyDefined) {
              graphmlEdges.add(graphmlEdge);
            }
            neighbourInSubnet=true;
            break;
          }
        }
      }
      if (!neighbourInSubnet) {
        EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,node.getId(),neighbourId,node.getId(),localMac,neighbourMac);
        GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
        graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
        boolean edgeAlreadyDefined=false;
        for (        GraphmlEdge edge : graphmlEdges) {
          if (edge.getId().equals(graphmlEdge.getId())) {
            edgeAlreadyDefined=true;
            int index=graphmlEdges.indexOf(edge);
            logger.info(graphmlEdge + "String_Node_Str");
            List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
            List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
            edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
            graphmlEdges.set(index,edge);
          }
        }
        if (!edgeAlreadyDefined) {
          graphmlEdges.add(graphmlEdge);
        }
      }
    }
  }
  for (  DeviceNeighbour deviceNeighbour : device.getLogicalDeviceData().getDeviceNeighbourList()) {
    String neighbourIpAddress=deviceNeighbour.getNeighbourIpAddress();
    String neighbourHostName=deviceNeighbour.getNeighbourHostName();
    String neighbourMac=deviceNeighbour.getNeighbourMac();
    AliasResolver aliasResolver=new AliasResolver(node,neighbourHostName,neighbourIpAddress,neighbourMac);
    String neighbourId=aliasResolver.getNeighbourIdFromAliases();
    if (neighbourId == null)     continue;
    boolean neighbourInSubnet=false;
    if (neighbourIpAddress != null && !neighbourIpAddress.isEmpty()) {
      for (      Subnet subnet : subnetSet) {
        if (subnet.contains(neighbourIpAddress)) {
          EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,subnet.getName(),neighbourIpAddress,subnet.getIpAddress());
          GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
          graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
          boolean edgeAlreadyDefined=false;
          for (          GraphmlEdge edge : graphmlEdges) {
            if (edge.getId().equals(graphmlEdge.getId())) {
              edgeAlreadyDefined=true;
              int index=graphmlEdges.indexOf(edge);
              logger.info(graphmlEdge + "String_Node_Str");
              List<GraphmlEdgeData> existingGraphmlEdgeDatas=edge.getGraphmlEdgeDataList();
              List<GraphmlEdgeData> newGraphmlEdgeDatas=graphmlEdge.getGraphmlEdgeDataList();
              edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(existingGraphmlEdgeDatas,newGraphmlEdgeDatas)));
              graphmlEdges.set(index,edge);
            }
          }
          if (!edgeAlreadyDefined) {
            graphmlEdges.add(graphmlEdge);
          }
          neighbourInSubnet=true;
          break;
        }
      }
    }
    if (!neighbourInSubnet) {
      EdgeIdGenerator edgeIdGenerator=new EdgeIdGenerator(neighbourId,node.getId(),neighbourId,node.getId());
      GraphmlEdge graphmlEdge=edgeIdGenerator.createEdge();
      graphmlEdge.setGraphmlEdgeDataList(getGraphmlDirectNeighbourEdgeMetaData(deviceNeighbour));
      boolean edgeAlreadyDefined=false;
      for (      GraphmlEdge edge : graphmlEdges) {
        if (edge.getId().equals(graphmlEdge.getId())) {
          edgeAlreadyDefined=true;
          int index=graphmlEdges.indexOf(edge);
          logger.info(graphmlEdge + "String_Node_Str");
          edge.setGraphmlEdgeDataList(new ArrayList<>(combineEdgeMetaDatas(edge.getGraphmlEdgeDataList(),graphmlEdge.getGraphmlEdgeDataList())));
          graphmlEdges.set(index,edge);
        }
      }
      if (!edgeAlreadyDefined) {
        graphmlEdges.add(graphmlEdge);
      }
    }
  }
  return graphmlEdges;
}