Program: 148403
Project: 148403
Buggy source:
public IStatus doAction(){
  try {
    ISelection selection=page.getTreeViewer().getSelection();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getSchemaContentProvider();
    XSDComplexTypeDefinition decl=(XSDComplexTypeDefinition)((IStructuredSelection)selection).getFirstElement();
    String oldName=decl.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new IInputValidator(){
      public String isValid(      String newText){
        if ((newText == null) || "String_Node_Str".equals(newText))         return "String_Node_Str";
        if (Pattern.compile("String_Node_Str").matcher(newText).matches() || newText.trim().replaceAll("String_Node_Str","String_Node_Str").length() != newText.trim().length())         return "String_Node_Str";
        EList list=schema.getTypeDefinitions();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          Object d=iter.next();
          if (d instanceof XSDComplexTypeDefinition) {
            XSDComplexTypeDefinition type=(XSDComplexTypeDefinition)d;
            if (type.getName().equals(newText.trim()))             return "String_Node_Str";
          }
        }
        return null;
      }
    }
);
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    decl.setName(id.getValue().trim());
    Util.updateComplexType(page.getSite(),decl,provider);
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    log.error(e.getStackTrace());
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  try {
    ISelection selection=page.getTreeViewer().getSelection();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getSchemaContentProvider();
    XSDComplexTypeDefinition decl=(XSDComplexTypeDefinition)((IStructuredSelection)selection).getFirstElement();
    String oldName=decl.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new IInputValidator(){
      public String isValid(      String newText){
        if ((newText == null) || "String_Node_Str".equals(newText))         return "String_Node_Str";
        if (Pattern.compile("String_Node_Str").matcher(newText).matches() || newText.trim().replaceAll("String_Node_Str","String_Node_Str").length() != newText.trim().length())         return "String_Node_Str";
        EList list=schema.getTypeDefinitions();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          Object d=iter.next();
          if (d instanceof XSDComplexTypeDefinition) {
            XSDComplexTypeDefinition type=(XSDComplexTypeDefinition)d;
            if (type.getName().equals(newText.trim()))             return "String_Node_Str";
          }
        }
        return null;
      }
    }
);
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    decl.setName(id.getValue().trim());
    Util.updateComplexType(page.getSite(),decl,provider);
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}