Program: 123251
Project: 123251
Buggy source:
@Override public void execute(){
  if (createdNode == null || objects.getToTransfer() == null || targetEditPart == null || dropType == null) {
    return;
  }
  Object targetModel=targetEditPart.getModel();
  for (  Object obj : objects.getToTransfer()) {
    if (objects.getType() == TransferdType.INPUT) {
      TreeNodeEditPart part=(TreeNodeEditPart)obj;
      TreeNode sourceNode=(TreeNode)part.getModel();
      String expression=XmlMapUtil.convertToExpression(sourceNode.getXpath());
switch (dropType) {
case DROP_INSERT_OUTPUT:
        int index=-1;
      OutputXmlTree outputTree=null;
    if (targetModel instanceof OutputTreeNode) {
      OutputTreeNode targetNode=(OutputTreeNode)targetModel;
      if (targetNode.eContainer() instanceof OutputXmlTree) {
        outputTree=(OutputXmlTree)targetNode.eContainer();
        index=outputTree.getNodes().indexOf(targetNode);
      }
    }
 else     if (targetModel instanceof OutputXmlTree) {
      outputTree=(OutputXmlTree)targetModel;
    }
  if (outputTree != null) {
    fillTreeNode(outputTree.getNodes(),sourceNode,outputTree.getName(),expression,(OutputTreeNode)createdNode);
    if (index != -1) {
      outputTree.getNodes().add(index,(OutputTreeNode)createdNode);
    }
 else {
      outputTree.getNodes().add((OutputTreeNode)createdNode);
    }
    createConnection(sourceNode,createdNode);
    AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(sourceNode);
    createOutputMetadataColumn(abstractTree.getName(),outputTree.getName(),sourceNode.getName(),createdNode.getName(),index);
  }
break;
case DROP_INSERT_VAR:
VarNode targetVar=(VarNode)targetModel;
VarNode varNode=(VarNode)createdNode;
if (targetVar.eContainer() instanceof VarTable) {
VarTable varTable=(VarTable)targetVar.eContainer();
String name=getUniqueTableEntry(varTable.getNodes(),sourceNode.getName());
varNode.setName(name);
varNode.setType(sourceNode.getType());
varNode.setExpression(expression);
varTable.getNodes().add(varTable.getNodes().indexOf(targetVar),varNode);
createConnection(sourceNode,createdNode);
}
break;
case DROP_INSERT_INPUT:
if (targetModel instanceof InputXmlTree) {
InputXmlTree inputTree=(InputXmlTree)targetModel;
fillTreeNode(inputTree.getNodes(),sourceNode,inputTree.getName(),expression,(TreeNode)createdNode);
inputTree.getNodes().add((TreeNode)createdNode);
createLookupConnection(sourceNode,(TreeNode)createdNode);
AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(sourceNode);
createInputMetadataColumn(abstractTree.getName(),inputTree.getName(),sourceNode.getName(),createdNode.getName(),-1);
}
default :
break;
}
}
 else if (objects.getType() == TransferdType.VAR) {
VarNodeEditPart part=(VarNodeEditPart)obj;
VarNode sourceNode=(VarNode)part.getModel();
String tableName="String_Node_Str";
if (sourceNode.eContainer() instanceof VarTable) {
tableName=((VarTable)sourceNode.eContainer()).getName();
}
String expression=tableName + "String_Node_Str" + sourceNode.getName();
if (dropType == DropType.DROP_INSERT_OUTPUT) {
int index=-1;
OutputXmlTree outputTree=null;
if (targetModel instanceof OutputTreeNode) {
OutputTreeNode targetNode=(OutputTreeNode)targetModel;
if (targetNode.eContainer() instanceof OutputXmlTree) {
outputTree=(OutputXmlTree)targetNode.eContainer();
index=outputTree.getNodes().indexOf(targetNode);
}
}
 else if (targetModel instanceof OutputXmlTree) {
outputTree=(OutputXmlTree)targetModel;
}
if (outputTree != null) {
OutputTreeNode outputNode=(OutputTreeNode)createdNode;
String name=getUniqueTableEntry(outputTree.getNodes(),sourceNode.getName());
outputNode.setName(name);
outputNode.setType(sourceNode.getType());
outputNode.setExpression(expression);
outputNode.setXpath(XmlMapUtil.getXPath(outputTree.getName(),outputNode.getName(),outputNode.getNodeType()));
if (index != -1) {
outputTree.getNodes().add(index,(OutputTreeNode)createdNode);
}
 else {
outputTree.getNodes().add((OutputTreeNode)createdNode);
}
createConnection(sourceNode,createdNode);
List<IMetadataTable> metadataTargets=manager.getMapperComponent().getMetadataList();
IMetadataTable metadataTarget=null;
if (metadataTargets != null) {
for (IMetadataTable target : metadataTargets) {
if (target.getTableName().equals(outputTree.getName())) {
metadataTarget=target;
}
}
if (metadataTarget != null) {
IMetadataColumn createNewColumn=new MetadataColumn();
createNewColumn.setLabel(outputNode.getName());
createNewColumn.setTalendType(outputNode.getType());
createNewColumn.setNullable(true);
metadataTarget.getListColumns().add(createNewColumn);
manager.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().getTableViewerCreator().refresh();
}
}
}
}
}
}
}

Fixed version (ground truth):
@Override public void execute(){
  if (rq == null || objects.getToTransfer() == null || targetEditPart == null || dropType == null) {
    return;
  }
  Object targetModel=targetEditPart.getModel();
  for (  Object obj : objects.getToTransfer()) {
    AbstractNode createdNode=rq.getNewObject();
    if (objects.getType() == TransferdType.INPUT) {
      TreeNodeEditPart part=(TreeNodeEditPart)obj;
      TreeNode sourceNode=(TreeNode)part.getModel();
      String expression=XmlMapUtil.convertToExpression(sourceNode.getXpath());
switch (dropType) {
case DROP_INSERT_OUTPUT:
        int index=-1;
      OutputXmlTree outputTree=null;
    if (targetModel instanceof OutputTreeNode) {
      OutputTreeNode targetNode=(OutputTreeNode)targetModel;
      if (targetNode.eContainer() instanceof OutputXmlTree) {
        outputTree=(OutputXmlTree)targetNode.eContainer();
        index=outputTree.getNodes().indexOf(targetNode);
      }
    }
 else     if (targetModel instanceof OutputXmlTree) {
      outputTree=(OutputXmlTree)targetModel;
    }
  if (outputTree != null) {
    fillTreeNode(outputTree.getNodes(),sourceNode,outputTree.getName(),expression,(OutputTreeNode)createdNode);
    if (index != -1) {
      outputTree.getNodes().add(index,(OutputTreeNode)createdNode);
    }
 else {
      outputTree.getNodes().add((OutputTreeNode)createdNode);
    }
    createConnection(sourceNode,createdNode);
    AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(sourceNode);
    createOutputMetadataColumn(abstractTree.getName(),outputTree.getName(),sourceNode,createdNode.getName(),index);
  }
break;
case DROP_INSERT_VAR:
VarNode targetVar=(VarNode)targetModel;
VarNode varNode=(VarNode)createdNode;
if (targetVar.eContainer() instanceof VarTable) {
VarTable varTable=(VarTable)targetVar.eContainer();
String name=getUniqueTableEntry(varTable.getNodes(),sourceNode.getName());
varNode.setName(name);
varNode.setType(sourceNode.getType());
varNode.setExpression(expression);
varTable.getNodes().add(varTable.getNodes().indexOf(targetVar),varNode);
createConnection(sourceNode,createdNode);
}
break;
case DROP_INSERT_INPUT:
if (targetModel instanceof InputXmlTree) {
InputXmlTree inputTree=(InputXmlTree)targetModel;
fillTreeNode(inputTree.getNodes(),sourceNode,inputTree.getName(),expression,(TreeNode)createdNode);
inputTree.getNodes().add((TreeNode)createdNode);
createLookupConnection(sourceNode,(TreeNode)createdNode);
AbstractInOutTree abstractTree=XmlMapUtil.getAbstractInOutTree(sourceNode);
createInputMetadataColumn(abstractTree.getName(),inputTree.getName(),sourceNode,createdNode.getName(),-1);
}
default :
break;
}
}
 else if (objects.getType() == TransferdType.VAR) {
VarNodeEditPart part=(VarNodeEditPart)obj;
VarNode sourceNode=(VarNode)part.getModel();
String tableName="String_Node_Str";
if (sourceNode.eContainer() instanceof VarTable) {
tableName=((VarTable)sourceNode.eContainer()).getName();
}
String expression=tableName + "String_Node_Str" + sourceNode.getName();
if (dropType == DropType.DROP_INSERT_OUTPUT) {
int index=-1;
OutputXmlTree outputTree=null;
if (targetModel instanceof OutputTreeNode) {
OutputTreeNode targetNode=(OutputTreeNode)targetModel;
if (targetNode.eContainer() instanceof OutputXmlTree) {
outputTree=(OutputXmlTree)targetNode.eContainer();
index=outputTree.getNodes().indexOf(targetNode);
}
}
 else if (targetModel instanceof OutputXmlTree) {
outputTree=(OutputXmlTree)targetModel;
}
if (outputTree != null) {
OutputTreeNode outputNode=(OutputTreeNode)createdNode;
String name=getUniqueTableEntry(outputTree.getNodes(),sourceNode.getName());
outputNode.setName(name);
outputNode.setType(sourceNode.getType());
outputNode.setExpression(expression);
outputNode.setXpath(XmlMapUtil.getXPath(outputTree.getName(),outputNode.getName(),outputNode.getNodeType()));
if (index != -1) {
outputTree.getNodes().add(index,(OutputTreeNode)createdNode);
}
 else {
outputTree.getNodes().add((OutputTreeNode)createdNode);
}
createConnection(sourceNode,createdNode);
createOutputMetadataColumn(null,outputTree.getName(),sourceNode,createdNode.getName(),index);
}
}
}
}
switch (dropType) {
case DROP_INSERT_OUTPUT:
manager.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().getTableViewerCreator().refresh();
case DROP_INSERT_INPUT:
manager.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().getTableViewerCreator().refresh();
}
}