Program: 149028
Project: 149028
Buggy source:
public IStatus doAction(){
  try {
    conceptList=WorkbenchClipboard.getWorkbenchClipboard().getConcepts();
    XSDFactory factory=XSDFactory.eINSTANCE;
    if (!conceptList.isEmpty()) {
      typeList=Util.getTypeDefinition(conceptList.get(0).getSchema());
      for (Iterator it=conceptList.iterator(); it.hasNext(); ) {
        Object concept=it.next();
        if (concept instanceof XSDElementDeclaration) {
          XSDElementDeclaration new_copy_concept=factory.createXSDElementDeclaration();
          ;
          XSDElementDeclaration copy_concept=(XSDElementDeclaration)concept;
          new_copy_concept=(XSDElementDeclaration)copy_concept.cloneConcreteComponent(true,false);
          InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str","String_Node_Str" + copy_concept.getName(),new IInputValidator(){
            public String isValid(            String newText){
              if ((newText == null) || "String_Node_Str".equals(newText))               return "String_Node_Str";
              EList list=schema.getElementDeclarations();
              for (Iterator iter=list.iterator(); iter.hasNext(); ) {
                XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
                if (d.getName().equals(newText))                 return "String_Node_Str";
              }
              return null;
            }
          }
);
          id.setBlockOnOpen(true);
          int ret=id.open();
          if (ret == Window.CANCEL) {
            return Status.CANCEL_STATUS;
          }
          new_copy_concept.setName(id.getValue());
          for (int i=0; i < new_copy_concept.getIdentityConstraintDefinitions().size(); i++) {
            String name=new_copy_concept.getIdentityConstraintDefinitions().get(i).getName().replaceAll(copy_concept.getName(),new_copy_concept.getName());
            new_copy_concept.getIdentityConstraintDefinitions().get(i).setName(name);
          }
          new_copy_concept.updateElement();
          schema.getContents().add(new_copy_concept);
          addAnnotationForXSDElementDeclaration(copy_concept,new_copy_concept);
        }
      }
      HashMap<String,XSDTypeDefinition> typeDef=Util.getTypeDefinition(schema);
      for (      XSDTypeDefinition type : copyTypeSet) {
        if (typeDef.containsKey(type.getName()))         continue;
        XSDTypeDefinition typedefinitionClone=null;
        if (type instanceof XSDComplexTypeDefinition) {
          typedefinitionClone=factory.createXSDComplexTypeDefinition();
          typedefinitionClone=(XSDComplexTypeDefinition)type.cloneConcreteComponent(true,false);
          schema.getContents().add((XSDComplexTypeDefinition)typedefinitionClone);
          addAnnotationForComplexType((XSDComplexTypeDefinition)type,(XSDComplexTypeDefinition)typedefinitionClone);
        }
 else         if (type instanceof XSDSimpleTypeDefinition) {
          schema.getContents().add((XSDSimpleTypeDefinition)type.cloneConcreteComponent(true,false));
        }
      }
      schema.getElement();
      WSDataModel wsObject=(WSDataModel)(page.getXObject().getWsObject());
      wsObject.getXsdSchema();
      page.markDirty();
      page.refresh();
      getOperationHistory();
      WorkbenchClipboard.getWorkbenchClipboard().conceptsReset();
      typeList.clear();
      return Status.OK_STATUS;
    }
    return Status.CANCEL_STATUS;
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  try {
    conceptList=WorkbenchClipboard.getWorkbenchClipboard().getConcepts();
    XSDFactory factory=XSDFactory.eINSTANCE;
    if (!conceptList.isEmpty()) {
      List<String> concepts=new ArrayList<String>();
      int index=0;
      for (Iterator it=conceptList.iterator(); it.hasNext(); ) {
        if (conceptList.get(index).getSchema() != null) {
          concepts=Util.getConcepts(conceptList.get(index).getSchema());
          typeList=Util.getTypeDefinition(conceptList.get(index).getSchema());
        }
        index++;
        Object concept=it.next();
        if (concept instanceof XSDElementDeclaration) {
          if (concepts.contains(((XSDElementDeclaration)concept).getName())) {
            XSDElementDeclaration copy_concept=(XSDElementDeclaration)concept;
            XSDElementDeclaration new_copy_concept=factory.createXSDElementDeclaration();
            ;
            new_copy_concept=(XSDElementDeclaration)copy_concept.cloneConcreteComponent(true,false);
            InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str","String_Node_Str" + copy_concept.getName(),new IInputValidator(){
              public String isValid(              String newText){
                if ((newText == null) || "String_Node_Str".equals(newText))                 return "String_Node_Str";
                EList list=schema.getElementDeclarations();
                for (Iterator iter=list.iterator(); iter.hasNext(); ) {
                  XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
                  if (d.getName().equals(newText))                   return "String_Node_Str";
                }
                return null;
              }
            }
);
            id.setBlockOnOpen(true);
            int ret=id.open();
            if (ret == Window.CANCEL) {
              return Status.CANCEL_STATUS;
            }
            new_copy_concept.setName(id.getValue());
            for (int i=0; i < new_copy_concept.getIdentityConstraintDefinitions().size(); i++) {
              String name=new_copy_concept.getIdentityConstraintDefinitions().get(i).getName().replaceAll(copy_concept.getName(),new_copy_concept.getName());
              new_copy_concept.getIdentityConstraintDefinitions().get(i).setName(name);
            }
            new_copy_concept.updateElement();
            schema.getContents().add(new_copy_concept);
            addAnnotationForXSDElementDeclaration(copy_concept,new_copy_concept);
          }
        }
      }
      HashMap<String,XSDTypeDefinition> typeDef=Util.getTypeDefinition(schema);
      for (      XSDTypeDefinition type : copyTypeSet) {
        if (typeDef.containsKey(type.getName()))         continue;
        XSDTypeDefinition typedefinitionClone=null;
        if (type instanceof XSDComplexTypeDefinition) {
          typedefinitionClone=factory.createXSDComplexTypeDefinition();
          typedefinitionClone=(XSDComplexTypeDefinition)type.cloneConcreteComponent(true,false);
          schema.getContents().add((XSDComplexTypeDefinition)typedefinitionClone);
          addAnnotationForComplexType((XSDComplexTypeDefinition)type,(XSDComplexTypeDefinition)typedefinitionClone);
        }
 else         if (type instanceof XSDSimpleTypeDefinition) {
          schema.getContents().add((XSDSimpleTypeDefinition)type.cloneConcreteComponent(true,false));
        }
      }
      schema.getElement();
      page.markDirty();
      page.refresh();
      getOperationHistory();
      WorkbenchClipboard.getWorkbenchClipboard().conceptsReset();
      typeList.clear();
      return Status.OK_STATUS;
    }
    return Status.CANCEL_STATUS;
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
  return Status.OK_STATUS;
}