Program: 124243
Project: 124243
Buggy source:
@Override public void run(){
  TreeNode treeNode=null;
  if (input) {
    treeNode=XmlmapFactory.eINSTANCE.createTreeNode();
  }
 else {
    treeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
  }
  IInputValidator validataor=new IInputValidator(){
    public String isValid(    String newText){
      String xpath=XmlMapUtil.getXPath(parent.getXpath(),newText,NodeType.ATTRIBUT);
      EList<TreeNode> children=parent.getChildren();
      boolean exist=false;
      for (      TreeNode child : children) {
        if (child.getXpath() != null && child.getXpath().equals(xpath)) {
          exist=true;
          break;
        }
      }
      if (exist) {
        return "String_Node_Str" + newText + "String_Node_Str";
      }
 else {
        return null;
      }
    }
  }
;
  InputDialog dialog=new InputDialog(null,"String_Node_Str","String_Node_Str","String_Node_Str",validataor);
  int open=dialog.open();
  if (open == Window.OK) {
    treeNode.setName(dialog.getValue());
    treeNode.setNodeType(NodeType.ATTRIBUT);
    treeNode.setXpath(XmlMapUtil.getXPath(this.parent.getXpath(),treeNode.getName(),treeNode.getNodeType()));
    treeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    final EList<TreeNode> children=parent.getChildren();
    int index=0;
    for (int i=0; i < children.size(); i++) {
      final TreeNode child=children.get(i);
      if (child.getNodeType() == NodeType.NAME_SPACE || child.getNodeType() == NodeType.ATTRIBUT) {
        if (i == children.size() - 1) {
          index=children.size();
        }
        continue;
      }
 else {
        index=i;
        break;
      }
    }
    children.add(index,treeNode);
  }
  if (open == Window.OK && mapperManager != null) {
    TreeNode docRoot=XmlMapUtil.getTreeNodeRoot(parent);
    if (input) {
      if (docRoot != null && docRoot.eContainer() instanceof InputXmlTree) {
        mapperManager.refreshInputTreeSchemaEditor((InputXmlTree)docRoot.eContainer());
      }
    }
 else {
      if (docRoot != null && docRoot.eContainer() instanceof OutputXmlTree) {
        mapperManager.refreshOutputTreeSchemaEditor((OutputXmlTree)docRoot.eContainer());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  TreeNode treeNode=null;
  if (input) {
    treeNode=XmlmapFactory.eINSTANCE.createTreeNode();
  }
 else {
    treeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
  }
  IInputValidator validataor=new IInputValidator(){
    public String isValid(    String newText){
      String xpath=XmlMapUtil.getXPath(parent.getXpath(),newText,NodeType.ATTRIBUT);
      EList<TreeNode> children=parent.getChildren();
      boolean exist=false;
      for (      TreeNode child : children) {
        if (child.getXpath() != null && child.getXpath().equals(xpath)) {
          exist=true;
          break;
        }
      }
      if (exist) {
        return "String_Node_Str" + newText + "String_Node_Str";
      }
 else {
        return null;
      }
    }
  }
;
  String label="String_Node_Str";
  InputDialog dialog=new InputDialog(null,"String_Node_Str","String_Node_Str","String_Node_Str",validataor);
  int open=-1;
  while (!StringUtil.validateLabelForXML(label)) {
    open=dialog.open();
    if (open == InputDialog.OK) {
      label=dialog.getValue().trim();
    }
    if (open == InputDialog.CANCEL) {
      return;
    }
  }
  if (open == Window.OK) {
    treeNode.setName(label);
    treeNode.setNodeType(NodeType.ATTRIBUT);
    treeNode.setXpath(XmlMapUtil.getXPath(this.parent.getXpath(),treeNode.getName(),treeNode.getNodeType()));
    treeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
    final EList<TreeNode> children=parent.getChildren();
    int index=0;
    for (int i=0; i < children.size(); i++) {
      final TreeNode child=children.get(i);
      if (child.getNodeType() == NodeType.NAME_SPACE || child.getNodeType() == NodeType.ATTRIBUT) {
        if (i == children.size() - 1) {
          index=children.size();
        }
        continue;
      }
 else {
        index=i;
        break;
      }
    }
    children.add(index,treeNode);
  }
  if (open == Window.OK && mapperManager != null) {
    TreeNode docRoot=XmlMapUtil.getTreeNodeRoot(parent);
    if (input) {
      if (docRoot != null && docRoot.eContainer() instanceof InputXmlTree) {
        mapperManager.refreshInputTreeSchemaEditor((InputXmlTree)docRoot.eContainer());
      }
    }
 else {
      if (docRoot != null && docRoot.eContainer() instanceof OutputXmlTree) {
        mapperManager.refreshOutputTreeSchemaEditor((OutputXmlTree)docRoot.eContainer());
      }
    }
  }
}