Program: 123666
Project: 123666
Buggy source:
private void createInputLoopTable(TreeNode sourceNode,OutputTreeNode targetOutputNode){
  InputLoopNodesTable inputLoopNodesTable=null;
  AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(targetOutputNode);
  if (abstractTree != null && abstractTree instanceof OutputXmlTree) {
    List<InputLoopNodesTable> listInputLoopNodesTablesEntry=((OutputXmlTree)abstractTree).getInputLoopNodesTables();
    if (!XmlMapUtil.hasDocument(abstractTree)) {
      if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 0) {
        inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
        listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
      }
 else       if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
        inputLoopNodesTable=listInputLoopNodesTablesEntry.get(0);
      }
    }
 else {
      OutputTreeNode loopParentOutputTreeNode=(OutputTreeNode)XmlMapUtil.getLoopParentNode(targetOutputNode);
      if (loopParentOutputTreeNode != null) {
        inputLoopNodesTable=loopParentOutputTreeNode.getInputLoopNodesTable();
        if (inputLoopNodesTable == null) {
          inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
          loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
          listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
        }
      }
    }
    if (inputLoopNodesTable == null) {
      return;
    }
    InputXmlTree inputTree=(InputXmlTree)XmlMapUtil.getAbstractInOutTree(sourceNode);
    TreeNode loopParentTreeNode=null;
    List<TreeNode> soruceLoops=new ArrayList<TreeNode>();
    if (inputTree != null) {
      if (!inputTree.isLookup() && inputTree.isMultiLoops()) {
        loopParentTreeNode=XmlMapUtil.getLoopParentNode((TreeNode)sourceNode);
        if (loopParentTreeNode != null) {
          soruceLoops.add(loopParentTreeNode);
        }
 else         if (inputLoopNodesTable.getInputloopnodes().isEmpty()) {
          loopParentTreeNode=XmlMapUtil.getFirstLoopOfATree(inputTree);
          if (loopParentTreeNode != null) {
            soruceLoops.add(loopParentTreeNode);
          }
        }
      }
 else {
        inputTree=null;
        for (        InputXmlTree input : xmlMapData.getInputTrees()) {
          if (!input.isLookup()) {
            inputTree=input;
            break;
          }
        }
        if (inputTree != null && inputTree.isMultiLoops()) {
          EList<LookupConnection> lookupIncomingConnections=sourceNode.getLookupIncomingConnections();
          boolean atLeastOneLookupFromMain=false;
          for (          LookupConnection lookupConn : lookupIncomingConnections) {
            TreeNode sourceTreeNode=(TreeNode)lookupConn.getSource();
            AbstractInOutTree sourceTree=XmlMapUtil.getAbstractInOutTree(sourceTreeNode);
            if (sourceTree == inputTree) {
              atLeastOneLookupFromMain=true;
              loopParentTreeNode=XmlMapUtil.getLoopParentNode(sourceTreeNode);
              if (loopParentTreeNode != null && !soruceLoops.contains(loopParentTreeNode)) {
                soruceLoops.add(loopParentTreeNode);
              }
            }
          }
          if (soruceLoops.isEmpty() && atLeastOneLookupFromMain) {
            loopParentTreeNode=XmlMapUtil.getFirstLoopOfATree(inputTree);
            if (loopParentTreeNode != null) {
              soruceLoops.add(loopParentTreeNode);
            }
          }
        }
      }
    }
    for (    TreeNode sourceLoop : soruceLoops) {
      if (!inputLoopNodesTable.getInputloopnodes().contains(sourceLoop)) {
        inputLoopNodesTable.getInputloopnodes().add(sourceLoop);
      }
    }
  }
}

Fixed version (ground truth):
private void createInputLoopTable(TreeNode sourceNode,OutputTreeNode targetOutputNode){
  EditPartViewer viewer=targetEditPart.getViewer();
  if (viewer instanceof XmlMapGraphicViewer) {
    InputLoopTableUtil.addSourceLoopToInputLoopTable(sourceNode,targetOutputNode,((XmlMapGraphicViewer)viewer).getMapperManager().getMainInputTree());
  }
}