nus-yam/ex-repair huggingface dataset:
Program: 148716
Project: 148716
Buggy source:
public java.util.List<XtentisPort> getPorts(){
  java.util.List<XtentisPort> ports=new ArrayList<XtentisPort>();
  XtentisPort port=null;
  try {
    TreeObject[] servers=contentProvider.getInvisibleRoot().getChildren();
    for (    TreeObject server : servers) {
      ports.add(Util.getPort(server));
    }
  }
 catch (  XtentisException e) {
    e.printStackTrace();
  }
  return ports;
}

Fixed version (ground truth):
public java.util.List<XtentisPort> getPorts(){
  java.util.List<XtentisPort> ports=new ArrayList<XtentisPort>();
  XtentisPort port=null;
  try {
    TreeObject[] servers=contentProvider.getInvisibleRoot().getChildren();
    for (    TreeObject server : servers) {
      if (server instanceof TreeParent) {
        if (!(((TreeParent)server).getChildren().length == 1 && ((TreeParent)server).getChildren()[0].getDisplayName().equalsIgnoreCase("String_Node_Str")))         ports.add(Util.getPort(server));
      }
    }
  }
 catch (  XtentisException e) {
    e.printStackTrace();
  }
  return ports;
}
Program: 148717
Project: 148717
Buggy source:
private void setAnnotationActions(Object obj,IMenuManager manager){
  manager.add(setAnnotationLabelAction);
  manager.add(setAnnotationDescriptionsAction);
  manager.add(setAnnotationForeignKeyAction);
  manager.add(setAnnotationFKFilterAction);
  manager.add(setAnnotationForeignKeyInfoAction);
  if (Util.IsEnterPrise()) {
    manager.add(setAnnotationWriteAction);
    manager.add(setAnnotationNoAction);
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.fillContextMenu(obj,manager,this,dataModelName);
  }
}

Fixed version (ground truth):
private void setAnnotationActions(Object obj,IMenuManager manager){
  manager.add(setAnnotationLabelAction);
  manager.add(setAnnotationDescriptionsAction);
  manager.add(setAnnotationForeignKeyAction);
  manager.add(setAnnotationFKFilterAction);
  manager.add(setAnnotationForeignKeyInfoAction);
  if (Util.IsEnterPrise()) {
    manager.add(setAnnotationWriteAction);
    if (checkMandatoryElement(obj))     manager.add(setAnnotationNoAction);
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.fillContextMenu(obj,manager,this,dataModelName);
  }
}
Program: 148718
Project: 148718
Buggy source:
private void setAnnotationActions2(Object obj,IMenuManager manager){
  manager.add(setAnnotationLabelAction);
  manager.add(setAnnotationDescriptionsAction);
  if (Util.IsEnterPrise()) {
    manager.add(setAnnotationWriteAction);
    manager.add(setAnnotationNoAction);
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.fillContextMenu(obj,manager,this,dataModelName);
  }
}

Fixed version (ground truth):
private void setAnnotationActions2(Object obj,IMenuManager manager){
  manager.add(setAnnotationLabelAction);
  manager.add(setAnnotationDescriptionsAction);
  if (Util.IsEnterPrise()) {
    manager.add(setAnnotationWriteAction);
    if (checkMandatoryElement(obj))     manager.add(setAnnotationNoAction);
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels();
  for (  IAvailableModel model : availablemodels) {
    model.fillContextMenu(obj,manager,this,dataModelName);
  }
}
Program: 148730
Project: 148730
Buggy source:
public static List<String> getChildElementNames(XSDElementDeclaration decl) throws Exception {
  List<String> childNames=new ArrayList<String>();
  XSDTypeDefinition type=decl.getTypeDefinition();
  if (type instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeDefinition cmpType=(XSDComplexTypeDefinition)type;
    if (cmpType.getContent() instanceof XSDParticle) {
      XSDParticleImpl particle=(XSDParticleImpl)cmpType.getContent();
      if (particle.getTerm() instanceof XSDModelGroup) {
        XSDModelGroup group=(XSDModelGroup)particle.getTerm();
        EList<XSDParticle> particles=group.getParticles();
        for (        XSDParticle part : particles) {
          if (part.getTerm() instanceof XSDElementDeclaration) {
            XSDElementDeclaration el=(XSDElementDeclaration)part.getTerm();
            childNames.add(el.getName());
          }
        }
      }
    }
  }
  return childNames;
}

Fixed version (ground truth):
public static List<String> getChildElementNames(String parentxpath,XSDElementDeclaration decl) throws Exception {
  List<String> childNames=new ArrayList<String>();
  XSDTypeDefinition type=decl.getTypeDefinition();
  if (type instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeDefinition cmpType=(XSDComplexTypeDefinition)type;
    if (cmpType.getContent() instanceof XSDParticle) {
      XSDParticleImpl particle=(XSDParticleImpl)cmpType.getContent();
      if (particle.getTerm() instanceof XSDModelGroup) {
        XSDModelGroup group=(XSDModelGroup)particle.getTerm();
        EList<XSDParticle> particles=group.getParticles();
        for (        XSDParticle part : particles) {
          if (part.getTerm() instanceof XSDElementDeclaration) {
            XSDElementDeclaration el=(XSDElementDeclaration)part.getTerm();
            if (el.getTypeDefinition() instanceof XSDSimpleTypeDefinition) {
              String child=parentxpath.length() == 0 ? el.getName() : parentxpath + "String_Node_Str" + el.getName();
              childNames.add(child);
            }
 else {
              childNames.addAll(getChildElementNames(el.getName(),el));
            }
          }
        }
      }
    }
  }
  return childNames;
}
Program: 148731
Project: 148731
Buggy source:
private void saveDocument(String url){
  XtentisPort port=credentials.get(url).port;
  Document doc=credentials.get(url).doc;
  try {
    port.getMDMCategory(new WSCategoryData(doc.asXML()));
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void saveDocument(String url){
  if (credentials.get(url) != null) {
    XtentisPort port=credentials.get(url).port;
    Document doc=credentials.get(url).doc;
    try {
      port.getMDMCategory(new WSCategoryData(doc.asXML()));
    }
 catch (    RemoteException e) {
      e.printStackTrace();
    }
  }
}
Program: 148733
Project: 148733
Buggy source:
protected void commit(){
  try {
    WSDataModel wsObject=(WSDataModel)(getXObject().getWsObject());
    wsObject.setDescription(descriptionText.getText() == null ? "String_Node_Str" : descriptionText.getText());
    String schema=((XSDTreeContentProvider)viewer.getContentProvider()).getXSDSchemaAsString();
    schema=schema.replaceAll("String_Node_Str","String_Node_Str");
    schema=schema.replaceAll("String_Node_Str","String_Node_Str");
    wsObject.setXsdSchema(schema);
    XSDImport xsdImport=XSDFactory.eINSTANCE.createXSDImport();
    xsdImport.setNamespace("String_Node_Str");
    if (xsdSchema == null) {
      xsdSchema=Util.createXsdSchema(schema,getXObject());
    }
    EList<XSDSchemaContent> elist=xsdSchema.getContents();
    for (    XSDSchemaContent cnt : elist) {
      if (cnt instanceof XSDImport) {
        XSDImport imp=(XSDImport)cnt;
        if (imp.getNamespace().equals("String_Node_Str")) {
          xsdImport=null;
          break;
        }
      }
    }
    if (xsdImport != null) {
      xsdSchema.getContents().add(0,xsdImport);
      wsObject.setXsdSchema(Util.nodeToString(xsdSchema.getDocument()));
    }
    XMLEditor xmleditor=(getEditor()).getXmlEditor();
    xmleditor.refresh(getXObject());
  }
 catch (  Exception e) {
    e.printStackTrace();
    ErrorExceptionDialog.openError(this.getSite().getShell(),"String_Node_Str",CommonUtil.getErrMsgFromException(e));
  }
}

Fixed version (ground truth):
protected void commit(){
  try {
    WSDataModel wsObject=(WSDataModel)(getXObject().getWsObject());
    wsObject.setDescription(descriptionText.getText() == null ? "String_Node_Str" : descriptionText.getText());
    String schema=((XSDTreeContentProvider)viewer.getContentProvider()).getXSDSchemaAsString();
    schema=schema.replaceAll("String_Node_Str","String_Node_Str");
    schema=schema.replaceAll("String_Node_Str","String_Node_Str");
    schema=Util.convertBaseType(schema);
    wsObject.setXsdSchema(schema);
    XSDImport xsdImport=XSDFactory.eINSTANCE.createXSDImport();
    xsdImport.setNamespace("String_Node_Str");
    if (xsdSchema == null) {
      xsdSchema=Util.createXsdSchema(schema,getXObject());
    }
    EList<XSDSchemaContent> elist=xsdSchema.getContents();
    for (    XSDSchemaContent cnt : elist) {
      if (cnt instanceof XSDImport) {
        XSDImport imp=(XSDImport)cnt;
        if (imp.getNamespace().equals("String_Node_Str")) {
          xsdImport=null;
          break;
        }
      }
    }
    if (xsdImport != null) {
      xsdSchema.getContents().add(0,xsdImport);
      wsObject.setXsdSchema(Util.nodeToString(xsdSchema.getDocument()));
    }
    XMLEditor xmleditor=(getEditor()).getXmlEditor();
    xmleditor.refresh(getXObject());
  }
 catch (  Exception e) {
    e.printStackTrace();
    ErrorExceptionDialog.openError(this.getSite().getShell(),"String_Node_Str",CommonUtil.getErrMsgFromException(e));
  }
}
Program: 148738
Project: 148738
Buggy source:
public String getServer(){
  return endpointsCombo.getText();
}

Fixed version (ground truth):
public String getServer(){
  return endpointsCombo.getText().trim();
}
Program: 148739
Project: 148739
Buggy source:
public String getPasswordText(){
  return passwordText.getText();
}

Fixed version (ground truth):
public String getPasswordText(){
  return passwordText.getText().trim();
}
Program: 148740
Project: 148740
Buggy source:
public String getUniverse(){
  if (Util.IsEnterPrise()) {
    return universeCombo.getText();
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String getUniverse(){
  if (Util.IsEnterPrise()) {
    return universeCombo.getText().trim();
  }
 else {
    return "String_Node_Str";
  }
}
Program: 148741
Project: 148741
Buggy source:
public String getUsernameText(){
  return userText.getText();
}

Fixed version (ground truth):
public String getUsernameText(){
  return userText.getText().trim();
}
Program: 148742
Project: 148742
Buggy source:
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    new ServerRefreshAction(view,serverRoot).run();
    return Status.OK_STATUS;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return Status.CANCEL_STATUS;
  }
}

Fixed version (ground truth):
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    Cursor wait=new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_WAIT);
    viewer.getControl().setCursor(wait);
    new ServerRefreshAction(view,serverRoot).run();
    viewer.expandToLevel(serverRoot,1);
    viewer.getControl().setCursor(new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_ARROW));
    return Status.OK_STATUS;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return Status.CANCEL_STATUS;
  }
}
Program: 148743
Project: 148743
Buggy source:
/** 
 * @author ymli; fix the bug:0012600. made the refresh as a job run underground
 * @param view
 * @param serverRoot
 * @return
 */
public boolean refreshServerRoot(final ServerView view,final TreeParent serverRoot){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        new ServerRefreshAction(view,serverRoot).run();
        return Status.OK_STATUS;
      }
 catch (      Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
      }
    }
  }
;
  job.setPriority(Job.LONG);
  job.schedule();
  return true;
}

Fixed version (ground truth):
/** 
 * @author ymli; fix the bug:0012600. made the refresh as a job run underground
 * @param view
 * @param serverRoot
 * @return
 */
public boolean refreshServerRoot(final ServerView view,final TreeParent serverRoot){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        Cursor wait=new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_WAIT);
        viewer.getControl().setCursor(wait);
        new ServerRefreshAction(view,serverRoot).run();
        viewer.expandToLevel(serverRoot,1);
        viewer.getControl().setCursor(new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_ARROW));
        return Status.OK_STATUS;
      }
 catch (      Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
      }
    }
  }
;
  job.setPriority(Job.LONG);
  job.schedule();
  return true;
}
Program: 148744
Project: 148744
Buggy source:
protected void initServer(TreeParent server){
  Cursor wait=new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_WAIT);
  viewer.getControl().setCursor(wait);
  refreshServerRoot(this,server);
  viewer.expandToLevel(server,1);
  viewer.getControl().setCursor(new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_ARROW));
}

Fixed version (ground truth):
protected void initServer(TreeParent server){
  refreshServerRoot(this,server);
}
Program: 148746
Project: 148746
Buggy source:
private void importClusterContents(TreeObject item,XtentisPort port){
  if (dataClusterContent.containsKey(item.getDisplayName())) {
    FileReader reader;
    try {
      String[] paths=dataClusterContent.get(item.getDisplayName());
      for (int i=0; i < paths.length; i++) {
        String path=paths[i];
        reader=new FileReader(importFolder + "String_Node_Str" + path);
        WSItem wsItem=(WSItem)Unmarshaller.unmarshal(WSItem.class,reader);
        if (wsItem.getDataModelName() == null) {
        }
 else {
          port.putItem(new WSPutItem(wsItem.getWsDataClusterPK(),wsItem.getContent(),new WSDataModelPK(wsItem.getDataModelName()),false));
        }
      }
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void importClusterContents(TreeObject item,XtentisPort port){
  if (dataClusterContent.containsKey(item.getDisplayName())) {
    FileReader reader;
    String[] paths=dataClusterContent.get(item.getDisplayName());
    for (int i=0; i < paths.length; i++) {
      try {
        String path=paths[i];
        reader=new FileReader(importFolder + "String_Node_Str" + path);
        WSItem wsItem=(WSItem)Unmarshaller.unmarshal(WSItem.class,reader);
        if (wsItem.getDataModelName() == null) {
        }
 else {
          port.putItem(new WSPutItem(wsItem.getWsDataClusterPK(),wsItem.getContent(),new WSDataModelPK(wsItem.getDataModelName()),false));
        }
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
  }
}
Program: 148748
Project: 148748
Buggy source:
public List<Line> buildLine(String criteria){
  List<Line> lines=new ArrayList<Line>();
  if (criteria != null) {
    String[] criterias=criteria.split("String_Node_Str");
    for (    String cria : criterias) {
      String[] values=cria.split("String_Node_Str");
      Line line=new Line(columns,values);
      lines.add(line);
    }
  }
  return lines;
}

Fixed version (ground truth):
public List<Line> buildLine(String criteria){
  List<Line> lines=new ArrayList<Line>();
  if (criteria != null) {
    String[] criterias=criteria.split("String_Node_Str");
    for (    String cria : criterias) {
      String[] values=cria.split("String_Node_Str");
      List<String> list=new ArrayList<String>();
      list.addAll(Arrays.asList(values));
      if (list.size() == 3) {
        list.add("String_Node_Str");
      }
      Line line=new Line(columns,list.toArray(new String[list.size()]));
      lines.add(line);
    }
  }
  return lines;
}
Program: 148750
Project: 148750
Buggy source:
@Override public boolean performFinish(){
  if (zipBtn.getSelection()) {
    zipfile=zip.getText().getText();
    importFolder=System.getProperty("String_Node_Str") + "String_Node_Str";
    try {
      ZipToFile.unZipFile(zipfile,importFolder);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  if (folderBtn.getSelection()) {
    importFolder=folder.getText().getText();
  }
  final TreeObject[] objs=treeViewer.getCheckNodes();
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        doImport(objs,monitor);
        port.initMDM(null);
        return Status.OK_STATUS;
      }
 catch (      Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
      }
 finally {
        new UIJob("String_Node_Str"){
          @Override public IStatus runInUIThread(          IProgressMonitor monitor){
            new ServerRefreshAction(view,serverRoot).run();
            return Status.OK_STATUS;
          }
        }
.schedule();
        if (zipfile != null) {
          ZipToFile.deleteDirectory(new File(importFolder));
        }
      }
    }
  }
;
  job.setPriority(Job.INTERACTIVE);
  job.schedule();
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  closeOpenEditors();
  if (zipBtn.getSelection()) {
    zipfile=zip.getText().getText();
    importFolder=System.getProperty("String_Node_Str") + "String_Node_Str";
    try {
      ZipToFile.unZipFile(zipfile,importFolder);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  if (folderBtn.getSelection()) {
    importFolder=folder.getText().getText();
  }
  final TreeObject[] objs=treeViewer.getCheckNodes();
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        doImport(objs,monitor);
        port.initMDM(null);
        return Status.OK_STATUS;
      }
 catch (      Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
      }
 finally {
        new UIJob("String_Node_Str"){
          @Override public IStatus runInUIThread(          IProgressMonitor monitor){
            new ServerRefreshAction(view,serverRoot).run();
            return Status.OK_STATUS;
          }
        }
.schedule();
        if (zipfile != null) {
          ZipToFile.deleteDirectory(new File(importFolder));
        }
      }
    }
  }
;
  job.setPriority(Job.INTERACTIVE);
  job.schedule();
  return true;
}
Program: 148751
Project: 148751
Buggy source:
private void closeOpenEditors(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  int length=page.getEditors().length;
  String version="String_Node_Str";
  String tabEndpointAddress="String_Node_Str";
  String unserName=null;
  int j=0;
  for (int i=0; i < length; i++) {
    IEditorPart part=page.getEditors()[i - j];
    if (part instanceof XObjectBrowser) {
      version=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getUniverse();
      tabEndpointAddress=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getEndpointAddress();
      unserName=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getUsername();
    }
 else     if (part instanceof XObjectEditor) {
      version=((XObjectEditor)part).getInitialXObject().getServerRoot().getUniverse();
      tabEndpointAddress=((XObjectEditor)part).getInitialXObject().getServerRoot().getEndpointAddress();
      unserName=((XObjectEditor)part).getInitialXObject().getServerRoot().getUsername();
    }
    if (serverRoot.getUniverse().equals(version) && serverRoot.getEndpointAddress().equals(tabEndpointAddress) && serverRoot.getUsername().equals(unserName)) {
      page.closeEditor(part,false);
      j++;
    }
  }
}

Fixed version (ground truth):
private void closeOpenEditors(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  int length=page.getEditors().length;
  String version="String_Node_Str";
  String tabEndpointAddress="String_Node_Str";
  String unserName=null;
  int j=0;
  for (int i=0; i < length; i++) {
    IEditorPart part=page.getEditors()[i - j];
    if (part instanceof XObjectBrowser) {
      version=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getUniverse();
      tabEndpointAddress=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getEndpointAddress();
      unserName=((TreeObject)((XObjectBrowserInput)part.getEditorInput()).getModel()).getUsername();
    }
 else     if (part instanceof XObjectEditor) {
      version=((XObjectEditor)part).getInitialXObject().getServerRoot().getUniverse();
      tabEndpointAddress=((XObjectEditor)part).getInitialXObject().getServerRoot().getEndpointAddress();
      unserName=((XObjectEditor)part).getInitialXObject().getServerRoot().getUsername();
    }
    if (serverRoot.getUniverse().equals(version) && serverRoot.getEndpointAddress().equals(tabEndpointAddress) && serverRoot.getUsername().equals(unserName)) {
      if (part.isDirty() && isSaveModifiedEditor(part.getTitle()))       part.doSave(new NullProgressMonitor());
      page.closeEditor(part,false);
      j++;
    }
  }
}
Program: 148758
Project: 148758
Buggy source:
private boolean filterRepositoryNode(TreeObject node){
  if (node == null) {
    return false;
  }
  if (node.getType() == TreeObject.SUBSCRIPTION_ENGINE || node.getType() == TreeObject.SERVICE_CONFIGURATION || node.getType() == TreeObject.WORKFLOW || node.getType() == TreeObject.WORKFLOW_PROCESS || node.getType() == TreeObject.JOB || node.getType() == TreeObject.JOB_REGISTRY) {
    return false;
  }
  if (!Util.IsEnterPrise()) {
    if (node.getType() == TreeObject.ROLE || node.getType() == TreeObject.UNIVERSE || node.getType() == TreeObject.SYNCHRONIZATIONPLAN) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean filterRepositoryNode(TreeObject node){
  if (node == null) {
    return false;
  }
  if (node.getType() == TreeObject.SUBSCRIPTION_ENGINE || node.getType() == TreeObject.SERVICE_CONFIGURATION || node.getType() == TreeObject.JOB || node.getType() == TreeObject.JOB_REGISTRY) {
    return false;
  }
  if (!Util.IsEnterPrise()) {
    if (node.getType() == TreeObject.ROLE || node.getType() == TreeObject.UNIVERSE || node.getType() == TreeObject.SYNCHRONIZATIONPLAN) {
      return false;
    }
  }
  return true;
}
Program: 148759
Project: 148759
Buggy source:
@Override public void createPartControl(Composite parent){
  super.createPartControl(parent);
  contributeToActionBars();
}

Fixed version (ground truth):
@Override public void createPartControl(Composite parent){
  super.createPartControl(parent);
}
Program: 148760
Project: 148760
Buggy source:
private void fillLocalToolBar(IToolBarManager manager){
  manager.add(loginAction);
  manager.add(new Separator());
  drillDownAdapter.addNavigationActions(manager);
}

Fixed version (ground truth):
private void fillLocalToolBar(IToolBarManager manager){
  manager.add(loginAction);
  manager.add(new Separator());
  manager.add(new RefreshCurrentEditorAction());
  manager.add(new Separator());
  manager.add(new Separator());
  drillDownAdapter.addNavigationActions(manager);
}
Program: 148762
Project: 148762
Buggy source:
protected void initServer(TreeParent server){
  Cursor wait=new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_WAIT);
  viewer.getControl().setCursor(wait);
  new ServerRefreshAction(this,server).run();
  viewer.expandToLevel(server,1);
  viewer.getControl().setCursor(new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_ARROW));
}

Fixed version (ground truth):
protected void initServer(TreeParent server){
  Cursor wait=new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_WAIT);
  viewer.getControl().setCursor(wait);
  refreshServerRoot(this,server);
  viewer.expandToLevel(server,1);
  viewer.getControl().setCursor(new Cursor(getViewSite().getShell().getDisplay(),SWT.CURSOR_ARROW));
}
Program: 148765
Project: 148765
Buggy source:
private boolean checkServer(Element root){
  List properties=root.elements("String_Node_Str");
  for (Iterator iterator=properties.iterator(); iterator.hasNext(); ) {
    Element ele=(Element)iterator.next();
    if (ele.element("String_Node_Str").getText().equals(endpointsCombo.getText()) && ele.element("String_Node_Str").getText().equals(userText.getText()) && ele.element("String_Node_Str").getText().equals(universeCombo.getText()))     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean checkServer(Element root){
  List properties=root.elements("String_Node_Str");
  for (Iterator iterator=properties.iterator(); iterator.hasNext(); ) {
    Element ele=(Element)iterator.next();
    if (ele.element("String_Node_Str").getText().equals(endpointsCombo.getText()) && ele.element("String_Node_Str").getText().equals(userText.getText()) && ele.element("String_Node_Str").getText().equals(passwordText.getText())&& ele.element("String_Node_Str").getText().equals(universeCombo.getText()))     return true;
  }
  return false;
}
Program: 148766
Project: 148766
Buggy source:
private void addServer(Element root){
  Element prop=root.addElement("String_Node_Str");
  Element url=prop.addElement("String_Node_Str");
  Element user=prop.addElement("String_Node_Str");
  Element password=prop.addElement("String_Node_Str");
  Element universe=prop.addElement("String_Node_Str");
  url.setText(endpointsCombo.getText());
  user.setText(userText.getText());
  if (savePasswordButton.getSelection() == true) {
    password.setText(PasswordUtil.encryptPassword(passwordText.getText()));
  }
  if (Util.IsEnterPrise())   universe.setText(universeCombo.getText());
}

Fixed version (ground truth):
private void addServer(Element root){
  Element prop=root.addElement("String_Node_Str");
  Element url=prop.addElement("String_Node_Str");
  Element user=prop.addElement("String_Node_Str");
  Element password=prop.addElement("String_Node_Str");
  Element universe=prop.addElement("String_Node_Str");
  url.setText(endpointsCombo.getText());
  user.setText(userText.getText());
  if (savePasswordButton.getSelection() == true)   password.setText(PasswordUtil.encryptPassword(passwordText.getText()));
 else   root.remove(prop);
  if (Util.IsEnterPrise())   universe.setText(universeCombo.getText());
}
Program: 148767
Project: 148767
Buggy source:
public NewConceptOrElementDialog(SelectionListener caller,Shell parentShell,XSDSchema sa,String title,List customTypes,List builtInTypes){
  super(parentShell);
  this.caller=caller;
  this.title=title;
  this.customTypes=customTypes;
  this.builtInTypes=builtInTypes;
  schema=sa;
}

Fixed version (ground truth):
public NewConceptOrElementDialog(SelectionListener caller,Shell parentShell,XSDSchema sa,String title,List<String> customTypes,List<String> builtInTypes){
  super(parentShell);
  this.caller=caller;
  this.title=title;
  this.customTypes=customTypes;
  this.builtInTypes=builtInTypes;
  schema=sa;
}
Program: 148769
Project: 148769
Buggy source:
public void initServerTreeParent(String url,String username,String password,String universe){
  TreeParent serverRoot=new TreeParent(url,null,TreeObject._SERVER_,url,("String_Node_Str".equals(universe) ? "String_Node_Str" : universe + "String_Node_Str") + username + "String_Node_Str"+ (password == null ? "String_Node_Str" : password));
  UserInfo user=new UserInfo();
  WSUniverse wUuniverse=null;
  XtentisPort port;
  try {
    port=Util.getPort(new URL(url),universe,username,password);
    wUuniverse=port.getCurrentUniverse(new WSGetCurrentUniverse());
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
catch (  XtentisException e) {
    e.printStackTrace();
  }
catch (  RemoteException e) {
    e.printStackTrace();
  }
  user.setUsername(username);
  user.setPassword(password);
  user.setServerUrl(url);
  user.setUniverse(universe);
  user.setWsUuniverse(wUuniverse);
  serverRoot.setUser(user);
  if ("String_Node_Str".equalsIgnoreCase(universe))   universe="String_Node_Str";
  serverRoot.setDisplayName(url + "String_Node_Str" + universe+ "String_Node_Str"+ username);
  TreeObject obj=new TreeObject("String_Node_Str",serverRoot,TreeObject._UNVISIBLE,serverRoot.getWsKey(),serverRoot.getWsObject());
  TreeParent invisibleRoot=getTreeContentProvider().getInvisibleRoot();
  invisibleRoot.addChild(serverRoot);
  getViewer().refresh();
}

Fixed version (ground truth):
public void initServerTreeParent(String url,String username,String password,String universe){
  TreeParent serverRoot=new TreeParent(url,null,TreeObject._SERVER_,url,("String_Node_Str".equals(universe) ? "String_Node_Str" : universe + "String_Node_Str") + username + "String_Node_Str"+ (password == null ? "String_Node_Str" : password));
  UserInfo user=new UserInfo();
  WSUniverse wUuniverse=null;
  XtentisPort port;
  try {
    port=Util.getPort(new URL(url),universe,username,password);
    wUuniverse=port.getCurrentUniverse(new WSGetCurrentUniverse());
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
catch (  XtentisException e) {
    e.printStackTrace();
  }
catch (  RemoteException e) {
    e.printStackTrace();
  }
  user.setUsername(username);
  user.setPassword(password);
  user.setServerUrl(url);
  user.setUniverse(universe);
  user.setWsUuniverse(wUuniverse);
  serverRoot.setUser(user);
  if ("String_Node_Str".equalsIgnoreCase(universe))   universe="String_Node_Str";
  serverRoot.setDisplayName(url + "String_Node_Str" + universe+ "String_Node_Str"+ username);
  TreeObject obj=new TreeObject("String_Node_Str",serverRoot,TreeObject._INVISIBLE,null,null);
  ArrayList list=new ArrayList(){
  }
;
  list.add(obj);
  serverRoot.setChildren(list);
  TreeParent invisibleRoot=getTreeContentProvider().getInvisibleRoot();
  invisibleRoot.addChild(serverRoot);
}
Program: 148770
Project: 148770
Buggy source:
public void doubleClick(DoubleClickEvent event){
  ISelection selection=ServerView.this.getViewer().getSelection();
  TreeObject xo=(TreeObject)((IStructuredSelection)selection).getFirstElement();
  if (xo.getType() == TreeObject._ACTION_) {
    Class<?> actionClass=(Class<?>)xo.getWsKey();
    try {
      AServerViewAction action=(AServerViewAction)actionClass.newInstance();
      action.setServerView(ServerView.this);
      action.run();
    }
 catch (    Exception ex) {
      MessageDialog.openError(viewer.getControl().getShell(),"String_Node_Str","String_Node_Str");
    }
    return;
  }
  if (xo.getType() == TreeObject._SERVER_) {
    if (xo.getServerRoot().getChildren().length == 0) {
      String universe="String_Node_Str";
      String username="String_Node_Str";
      String password="String_Node_Str";
      if (xo.getWsObject().toString().contains("String_Node_Str")) {
        universe=xo.getWsObject().toString().split("String_Node_Str")[0];
        username=xo.getWsObject().toString().split("String_Node_Str")[1].split("String_Node_Str")[0];
        password=xo.getWsObject().toString().split("String_Node_Str")[1].split("String_Node_Str")[1];
      }
 else {
        username=xo.getWsObject().toString().split("String_Node_Str")[0];
        password=xo.getWsObject().toString().split("String_Node_Str")[1];
      }
      initServerTree(xo.getWsKey().toString(),username,password,universe);
      xo.getServerRoot().getParent().removeChild(xo.getServerRoot());
    }
  }
  if (xo.getType() == TreeObject.WORKFLOW)   return;
  if (xo.getType() == TreeObject.SUBSCRIPTION_ENGINE || (xo.getType() == TreeObject.DATA_CLUSTER && xo.isXObject()) || xo.getType() == TreeObject.WORKFLOW_PROCESS)   browseViewAction.run();
 else   editXObjectAction.run();
}

Fixed version (ground truth):
public void doubleClick(DoubleClickEvent event){
  ISelection selection=ServerView.this.getViewer().getSelection();
  TreeObject xo=(TreeObject)((IStructuredSelection)selection).getFirstElement();
  if (xo.getType() == TreeObject._ACTION_) {
    Class<?> actionClass=(Class<?>)xo.getWsKey();
    try {
      AServerViewAction action=(AServerViewAction)actionClass.newInstance();
      action.setServerView(ServerView.this);
      action.run();
    }
 catch (    Exception ex) {
      MessageDialog.openError(viewer.getControl().getShell(),"String_Node_Str","String_Node_Str");
    }
    return;
  }
  if (xo.getType() == TreeObject._SERVER_) {
    if (((TreeParent)xo).getChildrenList().size() == 1)     initServer((TreeParent)xo);
  }
  if (xo.getType() == TreeObject.WORKFLOW)   return;
  if (xo.getType() == TreeObject.SUBSCRIPTION_ENGINE || (xo.getType() == TreeObject.DATA_CLUSTER && xo.isXObject()) || xo.getType() == TreeObject.WORKFLOW_PROCESS)   browseViewAction.run();
 else   editXObjectAction.run();
}
Program: 148773
Project: 148773
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (dialog.getReturnCode() == -1)   return;
  elementName=dialog.getElementName();
  refName=dialog.getRefName();
  minOccurs=dialog.getMinOccurs();
  maxOccurs=dialog.getMaxOccurs();
  dialog.close();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (dialog.getReturnCode() == -1)   return;
  elementName=dialog.getElementName();
  refName=dialog.getRefName();
  minOccurs=dialog.getMinOccurs();
  maxOccurs=dialog.getMaxOccurs();
  XSDModelGroup group=(XSDModelGroup)selParticle.getContainer();
  for (Iterator iter=group.getContents().iterator(); iter.hasNext(); ) {
    XSDParticle p=(XSDParticle)iter.next();
    if (p.getTerm() instanceof XSDElementDeclaration) {
      XSDElementDeclaration thisDecl=(XSDElementDeclaration)p.getTerm();
      if (thisDecl.getName().equals(elementName)) {
        MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + elementName + "String_Node_Str");
        return;
      }
    }
  }
  dialog.close();
}
Program: 148778
Project: 148778
Buggy source:
private void addLabelForTheItem(TreeItem[] items,boolean isAdd){
  XSDComponent xSDCom=null;
  XSDAnnotationsStructure struc=null;
  for (int i=0; i < items.length; i++) {
    TreeItem item=items[i];
    String labelValue=null;
    if (item.getData() instanceof XSDElementDeclaration) {
      xSDCom=(XSDElementDeclaration)item.getData();
      struc=new XSDAnnotationsStructure(xSDCom);
      labelValue=((XSDElementDeclaration)xSDCom).getName();
      setLabel(struc,labelValue,isAdd);
      if (((XSDElementDeclaration)xSDCom).getTypeDefinition() instanceof XSDComplexTypeDefinition) {
        List childrenList=Util.getComplexTypeDefinitionChildren((XSDComplexTypeDefinition)((XSDElementDeclaration)xSDCom).getTypeDefinition());
        for (int j=0; j < childrenList.size(); j++) {
          List<XSDParticle> particles=new ArrayList<XSDParticle>();
          if (childrenList.get(j) instanceof XSDModelGroup)           particles=((XSDModelGroup)childrenList.get(j)).getParticles();
          for (int k=0; k < particles.size(); k++) {
            xSDCom=particles.get(k);
            struc=new XSDAnnotationsStructure(xSDCom);
            labelValue=((XSDElementDeclaration)((XSDParticle)xSDCom).getContent()).getName();
            setLabel(struc,labelValue,isAdd);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void addLabelForTheItem(TreeItem[] items,boolean isAdd){
  XSDComponent xSDCom=null;
  for (int i=0; i < items.length; i++) {
    TreeItem item=items[i];
    XSDAnnotationsStructure struc=null;
    String labelValue=null;
    if (item.getData() instanceof XSDElementDeclaration) {
      xSDCom=(XSDElementDeclaration)item.getData();
      struc=new XSDAnnotationsStructure(xSDCom);
      labelValue=((XSDElementDeclaration)xSDCom).getName();
      setLabel(struc,labelValue,isAdd);
      setLabelForElement((XSDElementDeclaration)xSDCom,isAdd);
    }
  }
}
Program: 148779
Project: 148779
Buggy source:
public void run(){
  try {
    TreeParent xobject=(TreeParent)((IStructuredSelection)view.getViewer().getSelection()).getFirstElement();
    serverObject=xobject.getServerRoot();
    if (xobject == null)     return;
    String server=(String)xobject.getServerRoot().getWsKey();
    ObjectRetriever retriever=new ObjectRetriever((TreeParent)xobject,server,serverObject.getUsername(),serverObject.getPassword(),serverObject.getUser().getUniverse());
    retriever.run(new NullProgressMonitor());
    ServerView.show().getViewer().refresh(xobject);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    TreeParent xobject=(TreeParent)((IStructuredSelection)view.getViewer().getSelection()).getFirstElement();
    serverObject=xobject.getServerRoot();
    if (xobject == null)     return;
    String server=(String)xobject.getServerRoot().getWsKey();
    ObjectRetriever retriever=new ObjectRetriever((TreeParent)xobject,server,serverObject.getUsername(),serverObject.getPassword(),serverObject.getUser().getUniverse());
    retriever.run(new NullProgressMonitor());
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 148780
Project: 148780
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (dialog.getReturnCode() == -1)   return;
  elementName=dialog.getElementName();
  refName=dialog.getRefName();
  minOccurs=dialog.getMinOccurs();
  maxOccurs=dialog.getMaxOccurs();
  XSDModelGroup group=(XSDModelGroup)selParticle.getContainer();
  for (Iterator iter=group.getContents().iterator(); iter.hasNext(); ) {
    XSDParticle p=(XSDParticle)iter.next();
    if (p.getTerm() instanceof XSDElementDeclaration) {
      XSDElementDeclaration thisDecl=(XSDElementDeclaration)p.getTerm();
      if (thisDecl.getName().equals(elementName)) {
        MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + elementName + "String_Node_Str");
        return;
      }
    }
  }
  dialog.close();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (dialog.getReturnCode() == -1)   return;
  elementName=dialog.getElementName();
  refName=dialog.getRefName();
  minOccurs=dialog.getMinOccurs();
  maxOccurs=dialog.getMaxOccurs();
  XSDModelGroup group=(XSDModelGroup)selParticle.getContainer();
  for (Iterator iter=group.getContents().iterator(); iter.hasNext(); ) {
    XSDParticle p=(XSDParticle)iter.next();
    if (p.getTerm() instanceof XSDElementDeclaration) {
      XSDElementDeclaration thisDecl=(XSDElementDeclaration)p.getTerm();
      if (thisDecl.getName().equals(elementName) && !initEleName.equalsIgnoreCase(elementName)) {
        MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + elementName + "String_Node_Str");
        return;
      }
    }
  }
  dialog.close();
}
Program: 148782
Project: 148782
Buggy source:
public void run(){
  try {
    WorkbenchClipboard.getWorkbenchClipboard().conceptsReset();
    IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
    for (Iterator<XSDElementDeclaration> iter=selection.iterator(); iter.hasNext(); ) {
      XSDElementDeclaration concept=iter.next();
      if (concept instanceof XSDElementDeclaration)       WorkbenchClipboard.getWorkbenchClipboard().add(concept);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    WorkbenchClipboard.getWorkbenchClipboard().conceptsReset();
    WorkbenchClipboard.getWorkbenchClipboard().particlesReset();
    IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
    if (selection.getFirstElement() instanceof XSDElementDeclaration) {
      for (Iterator<XSDElementDeclaration> iter=selection.iterator(); iter.hasNext(); ) {
        XSDElementDeclaration concept=iter.next();
        if (concept instanceof XSDElementDeclaration)         WorkbenchClipboard.getWorkbenchClipboard().add(concept);
      }
    }
 else     if (selection.getFirstElement() instanceof XSDParticle) {
      for (Iterator<XSDParticle> iter=selection.iterator(); iter.hasNext(); ) {
        XSDParticle particle=iter.next();
        if (particle instanceof XSDParticle)         WorkbenchClipboard.getWorkbenchClipboard().add(particle);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148783
Project: 148783
Buggy source:
public XSDCopyConceptAction(DataModelMainPage page,boolean multi){
  super();
  if (multi)   displayName="String_Node_Str";
  this.page=page;
  setImageDescriptor(ImageCache.getImage(EImage.COPY.getPath()));
  setText(displayName);
  setToolTipText(displayName);
}

Fixed version (ground truth):
public XSDCopyConceptAction(DataModelMainPage page,String title){
  super();
  displayName=title;
  this.page=page;
  setImageDescriptor(ImageCache.getImage(EImage.COPY.getPath()));
  setText(displayName);
  setToolTipText(displayName);
}
Program: 148784
Project: 148784
Buggy source:
public boolean checkInPasteType(){
  if (WorkbenchClipboard.getWorkbenchClipboard().getConcepts().size() <= 0)   return false;
 else   return true;
}

Fixed version (ground truth):
public boolean checkInPasteType(){
  if (WorkbenchClipboard.getWorkbenchClipboard().getConcepts().size() <= 0 && WorkbenchClipboard.getWorkbenchClipboard().getParticles().size() <= 0)   return false;
 else   return true;
}
Program: 148785
Project: 148785
Buggy source:
public XSDPasteConceptAction(DataModelMainPage page,boolean multi){
  super(page);
  this.page=page;
  if (multi)   displayName="String_Node_Str";
  setImageDescriptor(ImageCache.getImage(EImage.PASTE.getPath()));
  setText(displayName);
  setToolTipText("String_Node_Str");
}

Fixed version (ground truth):
public XSDPasteConceptAction(DataModelMainPage page,String title){
  super(page);
  this.page=page;
  displayName=title;
  setImageDescriptor(ImageCache.getImage(EImage.PASTE.getPath()));
  setText(displayName);
  setToolTipText("String_Node_Str");
}
Program: 148790
Project: 148790
Buggy source:
public void addChild(TreeObject child){
  if (child != null) {
    children.add(child);
    child.setParent(this);
    child.fireEvent(IXObjectModelListener.ADD,this,child);
  }
  LocalTreeObjectRepository.getInstance().correctDisplayNameForCategory(child);
}

Fixed version (ground truth):
public void addChild(TreeObject child){
  if (child != null) {
    children.remove(child);
    children.add(child);
    child.setParent(this);
    child.fireEvent(IXObjectModelListener.ADD,this,child);
  }
  LocalTreeObjectRepository.getInstance().correctDisplayNameForCategory(child);
}
Program: 148794
Project: 148794
Buggy source:
public static IStatus changeElementTypeToSequence(XSDElementDeclaration decl,int maxOccurs){
  if (maxOccurs < -1) {
    MessageDialog.openError(null,"String_Node_Str","String_Node_Str");
    return Status.CANCEL_STATUS;
  }
  XSDElementDeclaration parent=(XSDElementDeclaration)Util.getParent(decl);
  XSDComplexTypeDefinition compx=(XSDComplexTypeDefinition)parent.getTypeDefinition();
  XSDParticleImpl partCnt=(XSDParticleImpl)compx.getContent();
  XSDModelGroupImpl mdlGrp=(XSDModelGroupImpl)partCnt.getTerm();
  if ((maxOccurs > 1 || maxOccurs == -1) && mdlGrp.getCompositor() != XSDCompositor.SEQUENCE_LITERAL) {
    if (!MessageDialog.openConfirm(null,"String_Node_Str","String_Node_Str")) {
      return Status.CANCEL_STATUS;
    }
    mdlGrp.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
    partCnt.getElement().getAttributeNode("String_Node_Str").setNodeValue("String_Node_Str");
    partCnt.setMinOccurs(0);
    parent.updateElement();
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public static IStatus changeElementTypeToSequence(XSDElementDeclaration decl,int maxOccurs){
  if (maxOccurs < -1) {
    MessageDialog.openError(null,"String_Node_Str","String_Node_Str");
    return Status.CANCEL_STATUS;
  }
  if (Util.getParent(decl) instanceof XSDElementDeclaration) {
    XSDElementDeclaration parent=(XSDElementDeclaration)Util.getParent(decl);
    XSDComplexTypeDefinition compx=(XSDComplexTypeDefinition)parent.getTypeDefinition();
    XSDParticleImpl partCnt=(XSDParticleImpl)compx.getContent();
    XSDModelGroupImpl mdlGrp=(XSDModelGroupImpl)partCnt.getTerm();
    if ((maxOccurs > 1 || maxOccurs == -1) && mdlGrp.getCompositor() != XSDCompositor.SEQUENCE_LITERAL) {
      if (!MessageDialog.openConfirm(null,"String_Node_Str","String_Node_Str")) {
        return Status.CANCEL_STATUS;
      }
      mdlGrp.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
      partCnt.getElement().getAttributeNode("String_Node_Str").setNodeValue("String_Node_Str");
      partCnt.setMinOccurs(0);
      parent.updateElement();
    }
  }
 else {
    if (Util.getParent(decl) instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeDefinition compx=(XSDComplexTypeDefinition)Util.getParent(decl);
      XSDParticleImpl partCnt=(XSDParticleImpl)compx.getContent();
      XSDModelGroupImpl mdlGrp=(XSDModelGroupImpl)partCnt.getTerm();
      if ((maxOccurs > 1 || maxOccurs == -1) && mdlGrp.getCompositor() != XSDCompositor.SEQUENCE_LITERAL) {
        if (!MessageDialog.openConfirm(null,"String_Node_Str","String_Node_Str")) {
          return Status.CANCEL_STATUS;
        }
        mdlGrp.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
        partCnt.getElement().getAttributeNode("String_Node_Str").setNodeValue("String_Node_Str");
        partCnt.setMinOccurs(0);
        compx.updateElement();
      }
    }
  }
  return Status.OK_STATUS;
}
Program: 148797
Project: 148797
Buggy source:
public IStatus doAction(){
  List<String> customTypes=new ArrayList<String>();
  List<String> builtInTypes=new ArrayList<String>();
  for (Iterator iter=schema.getTypeDefinitions().iterator(); iter.hasNext(); ) {
    XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
    if (type instanceof XSDSimpleTypeDefinition)     customTypes.add(type.getName());
  }
  for (Iterator iter=schema.getSchemaForSchema().getTypeDefinitions().iterator(); iter.hasNext(); ) {
    XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
    if (type instanceof XSDSimpleTypeDefinition)     builtInTypes.add(type.getName());
  }
  dialog=new SimpleTypeInputDialog(this,page.getSite().getShell(),schema,"String_Node_Str",customTypes,builtInTypes);
  dialog.setBlockOnOpen(true);
  int ret=dialog.open();
  if (ret == Dialog.CANCEL) {
    return Status.CANCEL_STATUS;
  }
  XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
  XSDSimpleTypeDefinition typedef=factory.createXSDSimpleTypeDefinition();
  if (!builtIn) {
    XSDSimpleTypeDefinition std=schema.resolveSimpleTypeDefinition(typeName);
    if (!schema.getTypeDefinitions().contains(std)) {
      std.setBaseTypeDefinition(schema.resolveSimpleTypeDefinition(schema.getSchemaForSchemaNamespace(),"String_Node_Str"));
      schema.getContents().add(std);
    }
    typedef.setBaseTypeDefinition(std);
  }
  typedef.getFacetContents().removeAll(typedef.getFacetContents());
  typedef.updateElement();
  page.refresh();
  page.markDirty();
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  List<String> customTypes=new ArrayList<String>();
  List<String> builtInTypes=new ArrayList<String>();
  for (Iterator iter=schema.getSchemaForSchema().getTypeDefinitions().iterator(); iter.hasNext(); ) {
    XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
    if (type instanceof XSDSimpleTypeDefinition)     builtInTypes.add(type.getName());
  }
  dialog=new SimpleTypeInputDialog(this,page.getSite().getShell(),schema,"String_Node_Str",customTypes,builtInTypes);
  dialog.setBlockOnOpen(true);
  int ret=dialog.open();
  if (ret == Dialog.CANCEL) {
    return Status.CANCEL_STATUS;
  }
  XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
  XSDSimpleTypeDefinition typedef=factory.createXSDSimpleTypeDefinition();
  if (!builtIn) {
    XSDSimpleTypeDefinition std=schema.resolveSimpleTypeDefinition(typeName);
    if (!schema.getTypeDefinitions().contains(std)) {
      std.setBaseTypeDefinition(schema.resolveSimpleTypeDefinition(schema.getSchemaForSchemaNamespace(),"String_Node_Str"));
      schema.getContents().add(std);
    }
    typedef.setBaseTypeDefinition(std);
  }
  typedef.getFacetContents().removeAll(typedef.getFacetContents());
  typedef.updateElement();
  page.refresh();
  page.markDirty();
  return Status.OK_STATUS;
}