Program: 124954
Project: 124954
Buggy source:
private void calculateFilterConnections(AbstractInOutTable abstractTable,String newValue){
  PigMapData mapperData=(PigMapData)abstractTable.eContainer();
  List<TableEntryLocation> matchedLocations=expressionManager.parseTableEntryLocation((String)newValue);
  EList<FilterConnection> connections=abstractTable.getFilterIncomingConnections();
  List usefullConnections=new ArrayList();
  if (!matchedLocations.isEmpty()) {
    for (int i=0; i < matchedLocations.size(); i++) {
      TableEntryLocation currentLocation=matchedLocations.get(i);
      boolean found=false;
      for (      FilterConnection conn : connections) {
        TableEntryLocation sourceLocation=null;
        if (conn.getSource() instanceof TableNode) {
        }
        if (currentLocation.equals(sourceLocation)) {
          found=true;
          usefullConnections.add(conn);
          break;
        }
      }
      if (!found) {
      }
    }
    List<FilterConnection> copyOfConnections=new ArrayList<FilterConnection>(connections);
    copyOfConnections.removeAll(usefullConnections);
    for (    FilterConnection connection : copyOfConnections) {
      if (connection.getSource() != null) {
        if (connection.getSource().getFilterOutGoingConnections().contains(connection)) {
          connection.getSource().getFilterOutGoingConnections().remove(connection);
          mapperData.getConnections().remove(connection);
        }
      }
    }
    abstractTable.getFilterIncomingConnections().removeAll(copyOfConnections);
  }
 else   if (!connections.isEmpty()) {
    for (    FilterConnection connection : connections) {
      if (connection.getSource() != null) {
        if (connection.getSource().getFilterOutGoingConnections().contains(connection)) {
          connection.getSource().getFilterOutGoingConnections().remove(connection);
          mapperData.getConnections().remove(connection);
        }
      }
    }
    abstractTable.getFilterIncomingConnections().removeAll(connections);
  }
}

Fixed version (ground truth):
private void calculateFilterConnections(AbstractInOutTable abstractTable,String newValue){
  PigMapData mapperData=(PigMapData)abstractTable.eContainer();
  List<TableEntryLocation> matchedLocations=expressionManager.parseTableEntryLocation((String)newValue);
  EList<FilterConnection> connections=abstractTable.getFilterIncomingConnections();
  List usefullConnections=new ArrayList();
  if (!matchedLocations.isEmpty()) {
    for (int i=0; i < matchedLocations.size(); i++) {
      TableEntryLocation currentLocation=matchedLocations.get(i);
      boolean found=false;
      for (      FilterConnection conn : connections) {
        TableEntryLocation sourceLocation=null;
        String temp="String_Node_Str";
        if (conn.getSource() != null && conn.getSource() instanceof TableNode) {
          TableNode tableSourceNode=(TableNode)conn.getSource();
          if (tableSourceNode.eContainer() != null && tableSourceNode.eContainer() instanceof InputTable) {
            temp=((InputTable)tableSourceNode.eContainer()).getName() + "String_Node_Str" + conn.getSource().getName();
          }
          sourceLocation=expressionManager.parseTableEntryLocation(temp).get(0);
        }
        if (currentLocation.equals(sourceLocation)) {
          found=true;
          usefullConnections.add(conn);
          break;
        }
      }
      if (!found) {
        if (mapperData != null) {
          AbstractNode sourceNode=findConnectionSource(mapperData,currentLocation);
          if (sourceNode != null) {
            FilterConnection connection=PigmapFactory.eINSTANCE.createFilterConnection();
            sourceNode.getFilterOutGoingConnections().add(connection);
            abstractTable.getFilterIncomingConnections().add(connection);
            connection.setSource(sourceNode);
            connection.setTarget(abstractTable);
            mapperData.getConnections().add(connection);
            usefullConnections.add(connection);
          }
        }
      }
    }
    List<FilterConnection> copyOfConnections=new ArrayList<FilterConnection>(connections);
    copyOfConnections.removeAll(usefullConnections);
    for (    FilterConnection connection : copyOfConnections) {
      if (connection.getSource() != null) {
        if (connection.getSource().getFilterOutGoingConnections().contains(connection)) {
          connection.getSource().getFilterOutGoingConnections().remove(connection);
          mapperData.getConnections().remove(connection);
        }
      }
    }
    abstractTable.getFilterIncomingConnections().removeAll(copyOfConnections);
  }
 else   if (!connections.isEmpty()) {
    for (    FilterConnection connection : connections) {
      if (connection.getSource() != null) {
        if (connection.getSource().getFilterOutGoingConnections().contains(connection)) {
          connection.getSource().getFilterOutGoingConnections().remove(connection);
          mapperData.getConnections().remove(connection);
        }
      }
    }
    abstractTable.getFilterIncomingConnections().removeAll(connections);
  }
}