Program: 123779
Project: 123779
Buggy source:
@Override public void execute(){
  try {
    if (model != null) {
      if (DirectEditType.EXPRESSION.equals(type)) {
        List<TableEntryLocation> matchedLocations=expressionManager.parseTableEntryLocation((String)newValue);
        EList<? extends INodeConnection> connections=null;
        if (model instanceof OutputTreeNode || model instanceof VarNode) {
          connections=model.getIncomingConnections();
        }
 else         if (model instanceof TreeNode) {
          connections=((TreeNode)model).getLookupIncomingConnections();
        }
        List usefullConnections=new ArrayList();
        XmlMapData mapperData=XmlMapUtil.getXmlMapData(model);
        if (!matchedLocations.isEmpty()) {
          for (int i=0; i < matchedLocations.size(); i++) {
            TableEntryLocation currentLocation=matchedLocations.get(i);
            boolean found=false;
            for (            INodeConnection conn : connections) {
              TableEntryLocation sourceLocation=null;
              if (conn.getSource() instanceof TreeNode) {
                sourceLocation=expressionManager.parseTableEntryLocation(XmlMapUtil.convertToExpression(((TreeNode)conn.getSource()).getXpath())).get(0);
              }
 else               if (conn.getSource() instanceof VarNode) {
                VarNode varNode=(VarNode)conn.getSource();
                sourceLocation=new TableEntryLocation(((VarTable)varNode.eContainer()).getName(),varNode.getName());
              }
              if (currentLocation.equals(sourceLocation)) {
                found=true;
                usefullConnections.add(conn);
                break;
              }
            }
            if (!found) {
              if (mapperData != null) {
                String convertToXpath=XmlMapUtil.convertToXpath(currentLocation.toString());
                boolean findFromVar=false;
                if (model instanceof OutputTreeNode) {
                  findFromVar=true;
                }
                AbstractNode sourceNode=findConnectionSource(mapperData,currentLocation,XmlMapUtil.getXPathLength(convertToXpath),findFromVar);
                if (sourceNode != null) {
                  INodeConnection connection=null;
                  if (model instanceof OutputTreeNode || model instanceof VarNode) {
                    connection=XmlmapFactory.eINSTANCE.createConnection();
                    sourceNode.getOutgoingConnections().add((Connection)connection);
                    model.getIncomingConnections().add((Connection)connection);
                  }
 else                   if (model instanceof TreeNode && sourceNode instanceof TreeNode) {
                    TreeNode source=(TreeNode)sourceNode;
                    connection=XmlmapFactory.eINSTANCE.createLookupConnection();
                    source.getLookupOutgoingConnections().add((LookupConnection)connection);
                    ((TreeNode)model).getLookupIncomingConnections().add((LookupConnection)connection);
                  }
                  if (model instanceof OutputTreeNode && sourceNode instanceof TreeNode) {
                    OutputTreeNodeEditPart outputTreeNodeEditPart=null;
                    if (targetEditPart != null && targetEditPart instanceof OutputTreeNodeEditPart) {
                      outputTreeNodeEditPart=XmlMapUtil.getParentLoopNodeEditPart((OutputTreeNodeEditPart)targetEditPart);
                    }
                    loopParentTreeNode=XmlMapUtil.getLoopParentNode((TreeNode)sourceNode);
                    OutputTreeNode targetOutputNode=(OutputTreeNode)model;
                    if (loopParentTreeNode != null) {
                      InputLoopNodesTable inputLoopNodesTable=null;
                      AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(targetOutputNode);
                      if (abstractTree != null && abstractTree instanceof OutputXmlTree) {
                        listInputLoopNodesTablesEntry=((OutputXmlTree)abstractTree).getInputLoopNodesTables();
                        if (!XmlMapUtil.hasDocument(abstractTree)) {
                          if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 0) {
                            inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                            inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                            listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
                          }
 else                           if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
                            inputLoopNodesTable=listInputLoopNodesTablesEntry.get(0);
                            boolean isContain=false;
                            for (                            TreeNode treeNode : inputLoopNodesTable.getInputloopnodes()) {
                              if (treeNode.getXpath().equals(loopParentTreeNode.getXpath())) {
                                isContain=true;
                              }
                            }
                            if (!isContain) {
                              inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                            }
                          }
                        }
 else {
                          OutputTreeNode loopParentOutputTreeNode=(OutputTreeNode)XmlMapUtil.getLoopParentNode(targetOutputNode);
                          if (loopParentOutputTreeNode != null) {
                            if (loopParentOutputTreeNode.getInputLoopNodesTable() == null) {
                              inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                              if (outputTreeNodeEditPart != null) {
                                inputLoopNodesTable.eAdapters().add(outputTreeNodeEditPart);
                              }
                              inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                              loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                              listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
                            }
 else {
                              loopParentOutputTreeNode.getInputLoopNodesTable().getInputloopnodes().add(loopParentTreeNode);
                            }
                          }
                        }
                      }
                    }
                  }
                  connection.setSource(sourceNode);
                  connection.setTarget(model);
                  mapperData.getConnections().add(connection);
                  usefullConnections.add(connection);
                }
              }
            }
          }
        }
 else {
          if (!connections.isEmpty()) {
            if (model instanceof OutputTreeNode || model instanceof VarNode) {
              XmlMapUtil.detachConnectionsSouce(model,mapperData,false);
              model.getIncomingConnections().clear();
            }
 else             if (model instanceof TreeNode) {
              XmlMapUtil.detachLookupSource((TreeNode)model,mapperData);
              ((TreeNode)model).getLookupIncomingConnections().clear();
            }
          }
        }
        List<INodeConnection> copyOfConnections=new ArrayList<INodeConnection>(connections);
        copyOfConnections.removeAll(usefullConnections);
        if (model instanceof OutputTreeNode || model instanceof VarNode) {
          for (          INodeConnection connection : copyOfConnections) {
            if (connection.getSource() != null) {
              if (connection.getSource().getOutgoingConnections().contains(connection)) {
                connection.getSource().getOutgoingConnections().remove(connection);
                mapperData.getConnections().remove(connection);
              }
            }
          }
          model.getIncomingConnections().removeAll(copyOfConnections);
        }
 else         if (model instanceof TreeNode) {
          for (          INodeConnection connection : copyOfConnections) {
            if (connection.getSource() != null) {
              if (((TreeNode)connection.getSource()).getLookupOutgoingConnections().contains(connection)) {
                ((TreeNode)connection.getSource()).getLookupOutgoingConnections().remove(connection);
                mapperData.getConnections().remove(connection);
              }
            }
          }
          ((TreeNode)model).getLookupIncomingConnections().removeAll(copyOfConnections);
        }
        if (model instanceof OutputTreeNode) {
          OutputTreeNode outModel=(OutputTreeNode)model;
          if (NodeType.NAME_SPACE.equals(outModel.getNodeType()) && outModel.getExpression() != null && !"String_Node_Str".equals(model.getExpression())) {
            outModel.setDefaultValue("String_Node_Str");
          }
        }
      }
 else       if (DirectEditType.VAR_NODE_TYPE.equals(type)) {
        VarNode varModel=(VarNode)model;
        JavaType javaTypeFromLabel=JavaTypesManager.getJavaTypeFromLabel((String)newValue);
        if (javaTypeFromLabel == null) {
          javaTypeFromLabel=JavaTypesManager.getDefaultJavaType();
        }
        varModel.setType(javaTypeFromLabel.getId());
      }
 else       if (DirectEditType.NODE_NAME.equals(type)) {
        model.setName((String)newValue);
      }
      model.setExpression((String)newValue);
    }
  }
 catch (  PatternSyntaxException ex) {
  }
}

Fixed version (ground truth):
@Override public void execute(){
  try {
    if (model != null) {
      if (DirectEditType.EXPRESSION.equals(type)) {
        List<TableEntryLocation> matchedLocations=expressionManager.parseTableEntryLocation((String)newValue);
        EList<? extends INodeConnection> connections=null;
        if (model instanceof OutputTreeNode || model instanceof VarNode) {
          connections=model.getIncomingConnections();
        }
 else         if (model instanceof TreeNode) {
          connections=((TreeNode)model).getLookupIncomingConnections();
        }
        List usefullConnections=new ArrayList();
        XmlMapData mapperData=XmlMapUtil.getXmlMapData(model);
        if (!matchedLocations.isEmpty()) {
          for (int i=0; i < matchedLocations.size(); i++) {
            TableEntryLocation currentLocation=matchedLocations.get(i);
            boolean found=false;
            for (            INodeConnection conn : connections) {
              TableEntryLocation sourceLocation=null;
              if (conn.getSource() instanceof TreeNode) {
                sourceLocation=expressionManager.parseTableEntryLocation(XmlMapUtil.convertToExpression(((TreeNode)conn.getSource()).getXpath())).get(0);
              }
 else               if (conn.getSource() instanceof VarNode) {
                VarNode varNode=(VarNode)conn.getSource();
                sourceLocation=new TableEntryLocation(((VarTable)varNode.eContainer()).getName(),varNode.getName());
              }
              if (currentLocation.equals(sourceLocation)) {
                found=true;
                usefullConnections.add(conn);
                break;
              }
            }
            if (!found) {
              if (mapperData != null) {
                String convertToXpath=XmlMapUtil.convertToXpath(currentLocation.toString());
                boolean findFromVar=false;
                if (model instanceof OutputTreeNode) {
                  findFromVar=true;
                }
                AbstractNode sourceNode=findConnectionSource(mapperData,currentLocation,XmlMapUtil.getXPathLength(convertToXpath),findFromVar);
                if (sourceNode != null) {
                  INodeConnection connection=null;
                  if (model instanceof OutputTreeNode || model instanceof VarNode) {
                    connection=XmlmapFactory.eINSTANCE.createConnection();
                    sourceNode.getOutgoingConnections().add((Connection)connection);
                    model.getIncomingConnections().add((Connection)connection);
                  }
 else                   if (model instanceof TreeNode && sourceNode instanceof TreeNode) {
                    TreeNode source=(TreeNode)sourceNode;
                    connection=XmlmapFactory.eINSTANCE.createLookupConnection();
                    source.getLookupOutgoingConnections().add((LookupConnection)connection);
                    ((TreeNode)model).getLookupIncomingConnections().add((LookupConnection)connection);
                  }
                  if (model instanceof OutputTreeNode && sourceNode instanceof TreeNode) {
                    OutputTreeNodeEditPart outputTreeNodeEditPart=null;
                    if (targetEditPart != null && targetEditPart instanceof OutputTreeNodeEditPart) {
                      outputTreeNodeEditPart=XmlMapUtil.getParentLoopNodeEditPart((OutputTreeNodeEditPart)targetEditPart);
                    }
                    loopParentTreeNode=XmlMapUtil.getLoopParentNode((TreeNode)sourceNode);
                    OutputTreeNode targetOutputNode=(OutputTreeNode)model;
                    if (loopParentTreeNode != null) {
                      InputLoopNodesTable inputLoopNodesTable=null;
                      AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(targetOutputNode);
                      if (abstractTree != null && abstractTree instanceof OutputXmlTree) {
                        listInputLoopNodesTablesEntry=((OutputXmlTree)abstractTree).getInputLoopNodesTables();
                        if (!XmlMapUtil.hasDocument(abstractTree)) {
                          if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 0) {
                            inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                            inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                            listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
                          }
 else                           if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
                            inputLoopNodesTable=listInputLoopNodesTablesEntry.get(0);
                            boolean isContain=false;
                            for (                            TreeNode treeNode : inputLoopNodesTable.getInputloopnodes()) {
                              if (treeNode.getXpath().equals(loopParentTreeNode.getXpath())) {
                                isContain=true;
                              }
                            }
                            if (!isContain) {
                              inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                            }
                          }
                        }
 else {
                          OutputTreeNode loopParentOutputTreeNode=(OutputTreeNode)XmlMapUtil.getLoopParentNode(targetOutputNode);
                          if (loopParentOutputTreeNode != null) {
                            if (loopParentOutputTreeNode.getInputLoopNodesTable() == null) {
                              inputLoopNodesTable=XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                              if (outputTreeNodeEditPart != null) {
                                inputLoopNodesTable.eAdapters().add(outputTreeNodeEditPart);
                              }
                              inputLoopNodesTable.getInputloopnodes().add(loopParentTreeNode);
                              loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                              listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
                            }
 else {
                              if (outputTreeNodeEditPart != null) {
                                loopParentOutputTreeNode.getInputLoopNodesTable().eAdapters().add(outputTreeNodeEditPart);
                              }
                              loopParentOutputTreeNode.getInputLoopNodesTable().getInputloopnodes().add(loopParentTreeNode);
                            }
                          }
                        }
                      }
                    }
                  }
                  connection.setSource(sourceNode);
                  connection.setTarget(model);
                  mapperData.getConnections().add(connection);
                  usefullConnections.add(connection);
                }
              }
            }
          }
        }
 else {
          if (!connections.isEmpty()) {
            if (model instanceof OutputTreeNode || model instanceof VarNode) {
              XmlMapUtil.detachConnectionsSouce(model,mapperData,false);
              model.getIncomingConnections().clear();
            }
 else             if (model instanceof TreeNode) {
              XmlMapUtil.detachLookupSource((TreeNode)model,mapperData);
              ((TreeNode)model).getLookupIncomingConnections().clear();
            }
          }
        }
        List<INodeConnection> copyOfConnections=new ArrayList<INodeConnection>(connections);
        copyOfConnections.removeAll(usefullConnections);
        if (model instanceof OutputTreeNode || model instanceof VarNode) {
          for (          INodeConnection connection : copyOfConnections) {
            if (connection.getSource() != null) {
              if (connection.getSource().getOutgoingConnections().contains(connection)) {
                connection.getSource().getOutgoingConnections().remove(connection);
                mapperData.getConnections().remove(connection);
              }
            }
          }
          model.getIncomingConnections().removeAll(copyOfConnections);
        }
 else         if (model instanceof TreeNode) {
          for (          INodeConnection connection : copyOfConnections) {
            if (connection.getSource() != null) {
              if (((TreeNode)connection.getSource()).getLookupOutgoingConnections().contains(connection)) {
                ((TreeNode)connection.getSource()).getLookupOutgoingConnections().remove(connection);
                mapperData.getConnections().remove(connection);
              }
            }
          }
          ((TreeNode)model).getLookupIncomingConnections().removeAll(copyOfConnections);
        }
        if (model instanceof OutputTreeNode) {
          OutputTreeNode outModel=(OutputTreeNode)model;
          if (NodeType.NAME_SPACE.equals(outModel.getNodeType()) && outModel.getExpression() != null && !"String_Node_Str".equals(model.getExpression())) {
            outModel.setDefaultValue("String_Node_Str");
          }
        }
      }
 else       if (DirectEditType.VAR_NODE_TYPE.equals(type)) {
        VarNode varModel=(VarNode)model;
        JavaType javaTypeFromLabel=JavaTypesManager.getJavaTypeFromLabel((String)newValue);
        if (javaTypeFromLabel == null) {
          javaTypeFromLabel=JavaTypesManager.getDefaultJavaType();
        }
        varModel.setType(javaTypeFromLabel.getId());
      }
 else       if (DirectEditType.NODE_NAME.equals(type)) {
        model.setName((String)newValue);
      }
      model.setExpression((String)newValue);
    }
  }
 catch (  PatternSyntaxException ex) {
  }
}