nus-yam/ex-repair huggingface dataset:
Program: 148463
Project: 148463
Buggy source:
@Override protected void okPressed(){
  setReturnCode(OK);
  getButton(IDialogConstants.OK_ID).setData("String_Node_Str",MenuEntryDialog.this);
  try {
    String icon="String_Node_Str";
    if (wsMenuEntry.getIcon() != null) {
      if (!wsMenuEntry.getIcon().equalsIgnoreCase(getIconPathText().getText())) {
        Util.uploadImageFile(uripre + "String_Node_Str" + wsMenuEntry.getIcon(),"String_Node_Str","String_Node_Str","String_Node_Str",null);
        if (!"String_Node_Str".equalsIgnoreCase(getIconPathText().getText()))         icon=Util.uploadImageFile(uripre + "String_Node_Str",getIconPathText().getText(),"String_Node_Str","String_Node_Str",null);
        getIconPathText().setText(icon);
      }
    }
 else     if (!"String_Node_Str".equalsIgnoreCase(getIconPathText().getText()))     icon=Util.uploadImageFile(uripre + "String_Node_Str",getIconPathText().getText(),"String_Node_Str","String_Node_Str",null);
    getIconPathText().setText(icon);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void okPressed(){
  setReturnCode(OK);
  getButton(IDialogConstants.OK_ID).setData("String_Node_Str",MenuEntryDialog.this);
  try {
    String icon="String_Node_Str";
    if (wsMenuEntry.getIcon() != null) {
      if (!wsMenuEntry.getIcon().equalsIgnoreCase(getIconPathText().getText())) {
        Util.uploadImageFile(uripre + "String_Node_Str" + wsMenuEntry.getIcon(),"String_Node_Str","String_Node_Str","String_Node_Str",null);
        if (!"String_Node_Str".equalsIgnoreCase(getIconPathText().getText()))         icon=Util.uploadImageFile(uripre + "String_Node_Str",getIconPathText().getText(),"String_Node_Str","String_Node_Str",null);
        getIconPathText().setText(icon);
      }
    }
 else     if (!"String_Node_Str".equalsIgnoreCase(getIconPathText().getText()))     icon=Util.uploadImageFile(uripre + "String_Node_Str",getIconPathText().getText(),"String_Node_Str","String_Node_Str",null);
    getIconPathText().setText(icon);
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
}
Program: 148466
Project: 148466
Buggy source:
protected void refreshData(){
  try {
    Set<String> outputs=resultsMap.keySet();
    for (Iterator iter=outputs.iterator(); iter.hasNext(); ) {
      String output=(String)iter.next();
      if (output.startsWith(TransformerMainPage.DEFAULT_VAR))       output=DEFAULT_DISPLAY_TEXT;
      variablesCombo.add(output);
    }
    variablesCombo.select(0);
    String text=variablesCombo.getText();
    if (text.equals(DEFAULT_DISPLAY_TEXT)) {
      text=TransformerMainPage.DEFAULT_DISPLAY;
    }
    variablesViewer.setDocument(new Document(getText(text)));
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
protected void refreshData(){
  try {
    Set<String> outputs=resultsMap.keySet();
    for (Iterator iter=outputs.iterator(); iter.hasNext(); ) {
      String output=(String)iter.next();
      if (output.startsWith(TransformerMainPage.DEFAULT_VAR))       output=DEFAULT_DISPLAY_TEXT;
      variablesCombo.add(output);
    }
    variablesCombo.select(0);
    String text=variablesCombo.getText();
    if (text.equals(DEFAULT_DISPLAY_TEXT)) {
      text=TransformerMainPage.DEFAULT_DISPLAY;
    }
    variablesViewer.setDocument(new Document(getText(text)));
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148467
Project: 148467
Buggy source:
protected Control createDialogArea(Composite parent){
  try {
    parent.getShell().setText("String_Node_Str");
    Composite composite=(Composite)super.createDialogArea(parent);
    GridLayout layout=(GridLayout)composite.getLayout();
    layout.numColumns=2;
    map=new LinkedHashMap<Integer,Text>();
    for (int i=0; i < parameters.length; i++) {
      Label nameLabel=new Label(composite,SWT.NULL);
      nameLabel.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false,1,1));
      nameLabel.setText("String_Node_Str" + i + "String_Node_Str");
      Text nameText=new Text(composite,SWT.BORDER);
      nameText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
      nameText.setText(parameters[i]);
      map.put(new Integer(i),nameText);
    }
    return composite;
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return null;
  }
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  try {
    parent.getShell().setText("String_Node_Str");
    Composite composite=(Composite)super.createDialogArea(parent);
    GridLayout layout=(GridLayout)composite.getLayout();
    layout.numColumns=2;
    map=new LinkedHashMap<Integer,Text>();
    for (int i=0; i < parameters.length; i++) {
      Label nameLabel=new Label(composite,SWT.NULL);
      nameLabel.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false,1,1));
      nameLabel.setText("String_Node_Str" + i + "String_Node_Str");
      Text nameText=new Text(composite,SWT.BORDER);
      nameText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
      nameText.setText(parameters[i]);
      map.put(new Integer(i),nameText);
    }
    return composite;
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return null;
  }
}
Program: 148468
Project: 148468
Buggy source:
private void changeDomTree(final TreeParent pObject){
  String modelDisplay=dataModelCombo.getText();
  if (modelDisplay.length() == 0)   return;
  this.dataModelName=modelDisplay;
  XtentisPort port=null;
  try {
    port=Util.getPort(pObject);
  }
 catch (  XtentisException e3) {
    e3.printStackTrace();
  }
catch (  Exception e3) {
    e3.printStackTrace();
  }
  WSDataModel wsDataModel=null;
  try {
    wsDataModel=port.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
  }
 catch (  RemoteException e2) {
    e2.printStackTrace();
  }
  try {
    String schema=wsDataModel.getXsdSchema();
    XSDSchema xsd=Util.createXsdSchema(schema,pObject);
    provideViwerContent(xsd);
  }
 catch (  Exception e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
private void changeDomTree(final TreeParent pObject){
  String modelDisplay=dataModelCombo.getText();
  if (modelDisplay.length() == 0)   return;
  this.dataModelName=modelDisplay;
  XtentisPort port=null;
  try {
    port=Util.getPort(pObject);
  }
 catch (  XtentisException e3) {
    log.error(e3.getMessage(),e3);
  }
catch (  Exception e3) {
    log.error(e3.getMessage(),e3);
  }
  WSDataModel wsDataModel=null;
  try {
    wsDataModel=port.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
  }
 catch (  RemoteException e2) {
    log.error(e2.getMessage(),e2);
  }
  try {
    String schema=wsDataModel.getXsdSchema();
    XSDSchema xsd=Util.createXsdSchema(schema,pObject);
    provideViwerContent(xsd);
  }
 catch (  Exception e1) {
    log.error(e1.getMessage(),e1);
  }
}
Program: 148469
Project: 148469
Buggy source:
public void run(){
  if (this.server == null) {
    return;
  }
  closePage();
  IStructuredSelection selection=(IStructuredSelection)server.getViewer().getSelection();
  for (Iterator<TreeObject> iter=selection.iterator(); iter.hasNext(); ) {
    TreeObject xobject=iter.next();
    try {
      deleteJob(xobject);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void run(){
  if (this.server == null) {
    return;
  }
  closePage();
  IStructuredSelection selection=(IStructuredSelection)server.getViewer().getSelection();
  for (Iterator<TreeObject> iter=selection.iterator(); iter.hasNext(); ) {
    TreeObject xobject=iter.next();
    try {
      deleteJob(xobject);
    }
 catch (    Exception e) {
      log.error(e.getStackTrace());
    }
  }
}
Program: 148470
Project: 148470
Buggy source:
public IStatus doAction(){
  try {
    ArrayList customTypes=new ArrayList();
    for (Iterator iter=schema.getTypeDefinitions().iterator(); iter.hasNext(); ) {
      XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
      if (type instanceof XSDSimpleTypeDefinition)       customTypes.add(type.getName() + (type.getTargetNamespace() != null ? "String_Node_Str" + type.getTargetNamespace() : "String_Node_Str"));
    }
    ArrayList builtInTypes=new ArrayList();
    for (Iterator iter=schema.getSchemaForSchema().getTypeDefinitions().iterator(); iter.hasNext(); ) {
      XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
      if (type instanceof XSDSimpleTypeDefinition)       builtInTypes.add(type.getName());
    }
    NewConceptOrElementDialog id=new NewConceptOrElementDialog(this,page.getSite().getShell(),schema,"String_Node_Str",customTypes,builtInTypes);
    id.setBlockOnOpen(true);
    id.open();
    if (id.getReturnCode() == Window.CANCEL) {
      return Status.CANCEL_STATUS;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    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 {
    ArrayList customTypes=new ArrayList();
    for (Iterator iter=schema.getTypeDefinitions().iterator(); iter.hasNext(); ) {
      XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
      if (type instanceof XSDSimpleTypeDefinition)       customTypes.add(type.getName() + (type.getTargetNamespace() != null ? "String_Node_Str" + type.getTargetNamespace() : "String_Node_Str"));
    }
    ArrayList builtInTypes=new ArrayList();
    for (Iterator iter=schema.getSchemaForSchema().getTypeDefinitions().iterator(); iter.hasNext(); ) {
      XSDTypeDefinition type=(XSDTypeDefinition)iter.next();
      if (type instanceof XSDSimpleTypeDefinition)       builtInTypes.add(type.getName());
    }
    NewConceptOrElementDialog id=new NewConceptOrElementDialog(this,page.getSite().getShell(),schema,"String_Node_Str",customTypes,builtInTypes);
    id.setBlockOnOpen(true);
    id.open();
    if (id.getReturnCode() == Window.CANCEL) {
      return Status.CANCEL_STATUS;
    }
  }
 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;
}
Program: 148471
Project: 148471
Buggy source:
protected void refreshStep(int index){
  currentPlugin=index;
  if (index < 0) {
    stepWidget.inputViewer.setInput(new ArrayList<WSTransformerVariablesMapping>());
    stepWidget.outputViewer.setInput(new ArrayList<WSTransformerVariablesMapping>());
    return;
  }
  TransformerMainPage.this.refreshing=true;
  stepLabel.setText(transformer.getProcessSteps()[index].getDescription());
  String jndi=transformer.getProcessSteps()[index].getPluginJNDI().replaceAll(TRANSFORMER_PLUGIN,"String_Node_Str");
  pluginsCombo.setText(jndi);
  currentPluginName=jndi;
  pluginDescription.setText(pluginDescriptions.get(jndi) == null ? "String_Node_Str" : pluginDescriptions.get(jndi));
  stepText.setText("String_Node_Str");
  refreshParameterEditor();
  parameterEditor.setContent(XmlUtil.formatXmlSource(transformer.getProcessSteps()[index].getParameters()));
  stepWidget.setProcessStep(transformer.getProcessSteps()[index],index);
  disabledButton.setSelection(transformer.getProcessSteps()[index].getDisabled());
  WidgetUtils.enable(specsComposite,!disabledButton.getSelection());
  TransformerMainPage.this.refreshing=false;
}

Fixed version (ground truth):
protected void refreshStep(int index){
  currentPlugin=index;
  if (index < 0) {
    stepWidget.inputViewer.setInput(new ArrayList<WSTransformerVariablesMapping>());
    stepWidget.outputViewer.setInput(new ArrayList<WSTransformerVariablesMapping>());
    return;
  }
  TransformerMainPage.this.refreshing=true;
  stepLabel.setText(transformer.getProcessSteps()[index].getDescription());
  String jndi=transformer.getProcessSteps()[index].getPluginJNDI().replaceAll(TRANSFORMER_PLUGIN,"String_Node_Str");
  pluginsCombo.setText(jndi);
  currentPluginName=jndi;
  pluginDescription.setText(pluginDescriptions.get(jndi) == null ? "String_Node_Str" : pluginDescriptions.get(jndi));
  stepText.setText("String_Node_Str");
  refreshParameterEditor();
  String content=transformer.getProcessSteps()[index].getParameters();
  if (btnAutoIntent.getSelection())   content=XmlUtil.formatXmlSource(content);
  parameterEditor.setContent(content);
  stepWidget.setProcessStep(transformer.getProcessSteps()[index],index);
  disabledButton.setSelection(transformer.getProcessSteps()[index].getDisabled());
  WidgetUtils.enable(specsComposite,!disabledButton.getSelection());
  TransformerMainPage.this.refreshing=false;
}
Program: 148472
Project: 148472
Buggy source:
public void onXMLDocumentChanged(ExtensibleContentEditorPage source,ExtensibleEditorContent newCotent){
  if (refreshing)   return;
  if (TransformerMainPage.this.stepsList.getSelectionIndex() == -1)   return;
  TransformerMainPage.this.comitting=true;
  transformer.getProcessSteps()[stepsList.getSelectionIndex()].setParameters(newCotent.getContent());
  TransformerMainPage.this.comitting=false;
  markDirtyWithoutCommit();
}

Fixed version (ground truth):
public void onXMLDocumentChanged(ExtensibleContentEditorPage source,ExtensibleEditorContent newCotent){
  commitParameters(newCotent.getContent());
}
Program: 148474
Project: 148474
Buggy source:
private void initListenerForDataModelCombo(){
  comboDataModels.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      comboDataModels.setItems(allDataModelHolder.getAllDataModelNames());
    }
  }
);
  comboDataModels.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent event){
      txtXPath.setText("String_Node_Str");
      tvXPath.setInput(allDataModelHolder.getDataModel(comboDataModels.getText().trim()));
    }
  }
);
}

Fixed version (ground truth):
private void initListenerForDataModelCombo(){
  comboDataModels.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      String old=comboDataModels.getText().trim();
      String[] allModels=allDataModelHolder.getAllDataModelNames();
      comboDataModels.setItems(allModels);
      if (Arrays.asList(allModels).contains(old))       comboDataModels.setText(old);
    }
  }
);
  comboDataModels.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent event){
      txtXPath.setText("String_Node_Str");
      tvXPath.setInput(allDataModelHolder.getDataModel(comboDataModels.getText().trim()));
    }
  }
);
}
Program: 148475
Project: 148475
Buggy source:
@Override public void mouseDown(MouseEvent e){
  comboDataModels.setItems(allDataModelHolder.getAllDataModelNames());
}

Fixed version (ground truth):
@Override public void mouseDown(MouseEvent e){
  String old=comboDataModels.getText().trim();
  String[] allModels=allDataModelHolder.getAllDataModelNames();
  comboDataModels.setItems(allModels);
  if (Arrays.asList(allModels).contains(old))   comboDataModels.setText(old);
}
Program: 148476
Project: 148476
Buggy source:
private static void sycFileContents(IFile file,String content) throws Exception {
  if (file.exists())   file.setContents(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,new NullProgressMonitor());
}

Fixed version (ground truth):
private static void sycFileContents(IFile file,String content) throws Exception {
  if (file.exists())   file.setContents(new ByteArrayInputStream(content.getBytes("String_Node_Str")),IFile.FORCE,new NullProgressMonitor());
}
Program: 148477
Project: 148477
Buggy source:
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,null);
 else   sycFileContents(file,content);
  return file;
}

Fixed version (ground truth):
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes("String_Node_Str")),IFile.FORCE,null);
 else   sycFileContents(file,content);
  return file;
}
Program: 148479
Project: 148479
Buggy source:
public void run(){
  try {
    super.run();
    ISelection selection=this.server.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    server.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectBrowserInput(xobject,xobject.getDisplayName()),XObjectRevisionBrowser.ID);
  }
 catch (  Exception e) {
    e.printStackTrace();
    ErrorExceptionDialog.openError(server.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    super.run();
    ISelection selection=this.server.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    server.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectBrowserInput(xobject,xobject.getDisplayName()),XObjectRevisionBrowser.ID);
  }
 catch (  Exception e) {
    log.error(e.getStackTrace());
    ErrorExceptionDialog.openError(server.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148480
Project: 148480
Buggy source:
public void run(){
  try {
    super.run();
    TreeObject xobject=null;
    if (selObj == null) {
      ISelection selection=this.server.getViewer().getSelection();
      xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    }
 else {
      xobject=selObj;
    }
    server.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectBrowserInput(xobject,xobject.getDisplayName()),XObjectBrowser.ID);
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(server.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    super.run();
    TreeObject xobject=null;
    if (selObj == null) {
      ISelection selection=this.server.getViewer().getSelection();
      xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    }
 else {
      xobject=selObj;
    }
    server.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectBrowserInput(xobject,xobject.getDisplayName()),XObjectBrowser.ID);
  }
 catch (  Exception e) {
    log.error(e.getStackTrace());
    MessageDialog.openError(server.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148481
Project: 148481
Buggy source:
public void widgetSelected(SelectionEvent e){
  dlg=new XpathSelectDialog(composite.getShell(),treeParent,"String_Node_Str",site,false,null);
  dlg.setBlockOnOpen(true);
  dlg.open();
  if (dlg.getReturnCode() == Window.OK) {
    if (dlg.getXpath() != null && dlg.getXpath().length() > 0) {
      int point=dlg.getXpath().indexOf("String_Node_Str");
      if (point >= 0)       text.setText(value + dlg.getXpath().substring(0,point));
 else       text.setText(value + dlg.getXpath());
    }
    dlg.close();
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  dlg=new XpathSelectDialog(composite.getShell(),treeParent,"String_Node_Str",site,false,null);
  dlg.setBlockOnOpen(true);
  dlg.open();
  if (dlg.getReturnCode() == Window.OK) {
    text.setText(value + dlg.getEntityName());
    dlg.close();
  }
}
Program: 148482
Project: 148482
Buggy source:
public void modifyText(ModifyEvent e){
  String output=variablesCombo.getText();
  if (output.startsWith(TransformerMainPage.DEFAULT_DISPLAY))   output=TransformerMainPage.DEFAULT_VAR + output.substring(TransformerMainPage.DEFAULT_DISPLAY.length());
  ProcessResultsDialog.this.variablesViewer.setDocument(new Document(getText(output)));
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  String output=variablesCombo.getText();
  if (output.startsWith(TransformerMainPage.DEFAULT_DISPLAY))   output="String_Node_Str";
  ProcessResultsDialog.this.variablesViewer.setDocument(new Document(getText(output)));
}
Program: 148484
Project: 148484
Buggy source:
protected void refreshData(){
  try {
    Set<String> outputs=resultsMap.keySet();
    for (Iterator iter=outputs.iterator(); iter.hasNext(); ) {
      String output=(String)iter.next();
      if (output.startsWith(TransformerMainPage.DEFAULT_VAR))       output=TransformerMainPage.DEFAULT_DISPLAY + output.substring(TransformerMainPage.DEFAULT_VAR.length());
      variablesCombo.add(output);
    }
    variablesCombo.select(0);
    variablesViewer.setDocument(new Document(getText(variablesCombo.getText())));
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
protected void refreshData(){
  try {
    Set<String> outputs=resultsMap.keySet();
    for (Iterator iter=outputs.iterator(); iter.hasNext(); ) {
      String output=(String)iter.next();
      if (output.startsWith(TransformerMainPage.DEFAULT_VAR))       output="String_Node_Str";
      variablesCombo.add(output);
    }
    variablesCombo.select(0);
    variablesViewer.setDocument(new Document(getText(variablesCombo.getText())));
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(this.getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 148485
Project: 148485
Buggy source:
private boolean commitKeyAddition(){
  boolean hasChanges=false;
  for (  KeyWrapper eachKeyWrapper : getCommitedObj().getKeys()) {
    if (!eachKeyWrapper.isUserCreated())     continue;
    hasChanges=true;
    XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
    XSDIdentityConstraintDefinition newKey=factory.createXSDIdentityConstraintDefinition();
    newKey.setName(eachKeyWrapper.getName());
    XSDXPathDefinition selector=factory.createXSDXPathDefinition();
    selector.setValue(eachKeyWrapper.getSelector());
    selector.setVariety(XSDXPathVariety.SELECTOR_LITERAL);
    newKey.setSelector(selector);
    for (    FieldWrapper newFields : eachKeyWrapper.getFields()) {
      XSDXPathDefinition field=factory.createXSDXPathDefinition();
      field.setValue(newFields.getXPath());
      field.setVariety(XSDXPathVariety.FIELD_LITERAL);
      newKey.getFields().add(field);
    }
    getCommitedObj().getSourceEntity().getIdentityConstraintDefinitions().add(newKey);
    getCommitedObj().getSourceEntity().updateElement();
  }
  return hasChanges;
}

Fixed version (ground truth):
private boolean commitKeyAddition(){
  boolean hasChanges=false;
  for (  KeyWrapper eachKeyWrapper : getCommitedObj().getKeys()) {
    if (!eachKeyWrapper.isUserCreated())     continue;
    hasChanges=true;
    XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
    XSDIdentityConstraintDefinition newKey=factory.createXSDIdentityConstraintDefinition();
    newKey.setName(eachKeyWrapper.getName());
    newKey.setIdentityConstraintCategory(eachKeyWrapper.getType());
    XSDXPathDefinition selector=factory.createXSDXPathDefinition();
    selector.setValue(eachKeyWrapper.getSelector());
    selector.setVariety(XSDXPathVariety.SELECTOR_LITERAL);
    newKey.setSelector(selector);
    for (    FieldWrapper newFields : eachKeyWrapper.getFields()) {
      XSDXPathDefinition field=factory.createXSDXPathDefinition();
      field.setValue(newFields.getXPath());
      field.setVariety(XSDXPathVariety.FIELD_LITERAL);
      newKey.getFields().add(field);
    }
    getCommitedObj().getSourceEntity().getIdentityConstraintDefinitions().add(newKey);
    getCommitedObj().getSourceEntity().updateElement();
  }
  return hasChanges;
}
Program: 148486
Project: 148486
Buggy source:
public boolean checkInWriteType(Object[] selects){
  for (  Object obj : selects) {
    if (obj instanceof XSDElementDeclaration || obj instanceof XSDParticle || obj instanceof XSDAnnotation|| obj instanceof XSDSimpleTypeDefinition) {
      if (Util.IsAImporedElement((XSDConcreteComponent)obj,page.reConfigureXSDSchema(false)))       return false;
      continue;
    }
 else     return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean checkInWriteType(Object[] selects){
  for (  Object obj : selects) {
    if (obj instanceof XSDElementDeclaration || obj instanceof XSDParticle || obj instanceof XSDAnnotation) {
      if (Util.IsAImporedElement((XSDConcreteComponent)obj,page.reConfigureXSDSchema(false)))       return false;
      continue;
    }
 else     return false;
  }
  return true;
}
Program: 148487
Project: 148487
Buggy source:
@Override public int compareTo(TreeObject o){
  if (o == this)   return 0;
  if ((this instanceof TreeParent) && !(o instanceof TreeParent)) {
    return -1;
  }
 else   if (!(this instanceof TreeParent) && (o instanceof TreeParent)) {
    return 1;
  }
 else   if (!(this instanceof TreeParent) && !(o instanceof TreeParent)) {
    return this.getDisplayName().compareTo(((TreeObject)o).getDisplayName());
  }
 else {
    TreeParent pThis=(TreeParent)this;
    TreeParent pThat=(TreeParent)o;
    return pThis.getDisplayName().compareTo(pThat.getDisplayName());
  }
}

Fixed version (ground truth):
public int compareTo(TreeObject o){
  if (o == this)   return 0;
  if ((this instanceof TreeParent) && !(o instanceof TreeParent)) {
    return -1;
  }
 else   if (!(this instanceof TreeParent) && (o instanceof TreeParent)) {
    return 1;
  }
 else   if (!(this instanceof TreeParent) && !(o instanceof TreeParent)) {
    return this.getDisplayName().compareTo(((TreeObject)o).getDisplayName());
  }
 else {
    TreeParent pThis=(TreeParent)this;
    TreeParent pThat=(TreeParent)o;
    return pThis.getDisplayName().compareTo(pThat.getDisplayName());
  }
}
Program: 148488
Project: 148488
Buggy source:
private void onSelectLanguageInfoFrTree(){
  if (!isLanguageInfoSelected())   return;
  LanguageInfo selectedLangInfo=getSelectedLanguageInfo();
  comboLanguage.select(allLanguages.indexOf(selectedLangInfo));
  txtLabel.setText(selectedLangInfo.getLabel());
}

Fixed version (ground truth):
private void onSelectLanguageInfoFrTree(){
  if (!isLanguageInfoSelected())   return;
  LanguageInfo selectedLangInfo=getSelectedLanguageInfo();
  comboLanguage.select(allLanguages.indexOf(selectedLangInfo.getLanguage()));
  txtLabel.setText(selectedLangInfo.getLabel());
}
Program: 148489
Project: 148489
Buggy source:
public void modify(Object element,String property,Object value){
  LanguageInfo modifiedLangInfo=getLanguageInfoFromSelection(element);
  if (!isLanguageInfo(modifiedLangInfo))   return;
  if (isColumnLanguage(property) && isComboCellEditorValue(value)) {
    onModfiyColumnLanguage(modifiedLangInfo,(Integer)value);
  }
  if (isColumnLabel(property) && isTextCellEditorValue(value)) {
    onModfiyColumnLable(modifiedLangInfo,(String)value);
  }
  viewer.update(element,new String[0]);
}

Fixed version (ground truth):
public void modify(Object element,String property,Object value){
  LanguageInfo modifiedLangInfo=getLanguageInfoFromSelection(element);
  if (!isLanguageInfo(modifiedLangInfo))   return;
  if (isColumnLanguage(property) && isComboCellEditorValue(value)) {
    onModfiyColumnLanguage(modifiedLangInfo,(Integer)value);
  }
  if (isColumnLabel(property) && isTextCellEditorValue(value)) {
    onModfiyColumnLable(modifiedLangInfo,(String)value);
  }
  viewer.refresh();
}
Program: 148490
Project: 148490
Buggy source:
public IStatus doAction(){
  try {
    ISelection selection=page.getTreeViewer().getSelection();
    constraint=(XSDIdentityConstraintDefinition)((IStructuredSelection)selection).getFirstElement();
    String oldName=constraint.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new EditXSDIdentityConstraintNameValidator(constraint.getSchema()));
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    constraint.setName(id.getValue());
    constraint.updateElement();
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    e.printStackTrace();
    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();
    constraint=(XSDIdentityConstraintDefinition)((IStructuredSelection)selection).getFirstElement();
    String oldName=constraint.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new EditXSDIdentityConstraintNameValidator(constraint));
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    if (XSDIdentityConstraintCategory.UNIQUE_LITERAL.equals(constraint.getIdentityConstraintCategory()) && !((XSDElementDeclaration)constraint.getContainer()).getName().equals(id.getValue())) {
      MessageDialog.openWarning(page.getSite().getShell(),"String_Node_Str","String_Node_Str");
      return Status.CANCEL_STATUS;
    }
    constraint.setName(id.getValue());
    constraint.updateElement();
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}
Program: 148491
Project: 148491
Buggy source:
private void initListener2TvKeys(){
  lTvKeysSelectionListener=new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      Object selectedObj=((IStructuredSelection)event.getSelection()).getFirstElement();
      if (selectedObj instanceof KeyWrapper) {
        txtKeyName.setText(((KeyWrapper)selectedObj).getName());
        comboSelector.setText(((KeyWrapper)selectedObj).getSelector());
        tvFields.setInput(Arrays.asList(((KeyWrapper)selectedObj).getFields()));
      }
      refreshUI();
    }
  }
;
}

Fixed version (ground truth):
private void initListener2TvKeys(){
  lTvKeysSelectionListener=new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      Object selectedObj=((IStructuredSelection)event.getSelection()).getFirstElement();
      if (selectedObj instanceof KeyWrapper) {
        txtKeyName.setText(((KeyWrapper)selectedObj).getName());
        txtKeyName.setEditable(!((KeyWrapper)selectedObj).isUniqueKey());
        comboSelector.setText(((KeyWrapper)selectedObj).getSelector());
        tvFields.setInput(Arrays.asList(((KeyWrapper)selectedObj).getFields()));
      }
      refreshUI();
    }
  }
;
}
Program: 148492
Project: 148492
Buggy source:
public EditKeyWrapperNameValidator(EntityWrapper entityWrapper,KeyWrapper targetKeyWrapper){
  super(entityWrapper.getSchema());
  this.entityWrapper=entityWrapper;
  this.targetKeyWrapper=targetKeyWrapper;
}

Fixed version (ground truth):
public EditKeyWrapperNameValidator(EntityWrapper entityWrapper,KeyWrapper targetKeyWrapper){
  super(targetKeyWrapper.getSourceKey());
  this.entityWrapper=entityWrapper;
  this.targetKeyWrapper=targetKeyWrapper;
}
Program: 148493
Project: 148493
Buggy source:
private void refresh(){
  boolean isBuildInType=Util.isBuildInType(xsdSimpleType.getSchema(),xsdSimpleType);
  txtName.setEnabled(!isBuildInType);
  radCustomTypes.setEnabled(!isBuildInType);
  radBuildInTypes.setEnabled(!isBuildInType);
  compProperty.setEnabled(!isBuildInType);
  comboCustomTypes.getCombo().setEnabled(radCustomTypes.getSelection() && !isBuildInType);
  comboBuildInTypes.getCombo().setEnabled(radBuildInTypes.getSelection() && !isBuildInType);
  initUIContentForCompFacet(getSelectedBaseType());
}

Fixed version (ground truth):
private void refresh(){
  boolean isBuildInType=Util.isBuildInType(xsdSimpleType);
  txtName.setEnabled(!isBuildInType);
  radCustomTypes.setEnabled(!isBuildInType);
  radBuildInTypes.setEnabled(!isBuildInType);
  compProperty.setEditable(!isBuildInType);
  comboCustomTypes.getCombo().setEnabled(radCustomTypes.getSelection() && !isBuildInType);
  comboBuildInTypes.getCombo().setEnabled(radBuildInTypes.getSelection() && !isBuildInType);
  initUIContentForCompFacet(getSelectedBaseType());
}
Program: 148494
Project: 148494
Buggy source:
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=2;
  Label Label=new Label(composite,SWT.NONE);
  Label.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  Label.setText("String_Node_Str");
  keyNameText=new Text(composite,SWT.BORDER);
  keyNameText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  keyNameText.setText(keyName);
  Label serverLabel=new Label(composite,SWT.NONE);
  serverLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  serverLabel.setText("String_Node_Str");
  fieldNameCombo=new CCombo(composite,SWT.DROP_DOWN | SWT.BORDER);
  fieldNameCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  fieldNameCombo.setItems(deElements.toArray(new String[deElements.size()]));
  if (deElements.size() > 0)   fieldNameCombo.select(0);
  Label typeLabel=new Label(composite,SWT.NONE);
  typeLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  typeLabel.setText("String_Node_Str");
  typeCombo=new CCombo(composite,SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
  typeCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  typeCombo.add("String_Node_Str");
  typeCombo.add("String_Node_Str");
  typeCombo.select(0);
  return composite;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=2;
  Label Label=new Label(composite,SWT.NONE);
  Label.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  Label.setText("String_Node_Str");
  keyNameText=new Text(composite,SWT.BORDER);
  keyNameText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  keyNameText.setText(keyName);
  Label serverLabel=new Label(composite,SWT.NONE);
  serverLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  serverLabel.setText("String_Node_Str");
  fieldNameCombo=new CCombo(composite,SWT.DROP_DOWN | SWT.BORDER);
  fieldNameCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  fieldNameCombo.setItems(deElements.toArray(new String[deElements.size()]));
  if (deElements.size() > 0)   fieldNameCombo.select(0);
  Label typeLabel=new Label(composite,SWT.NONE);
  typeLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  typeLabel.setText("String_Node_Str");
  typeCombo=new CCombo(composite,SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
  typeCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  typeCombo.add("String_Node_Str");
  typeCombo.add("String_Node_Str");
  typeCombo.select(0);
  keyNameText.setEditable(isSimpleKey());
  initUIListener();
  return composite;
}
Program: 148495
Project: 148495
Buggy source:
private Object[] getXSDSimpleTypeDefinitionChildren_ATOMIC(XSDSimpleTypeDefinition parent){
  ArrayList<Object> list=new ArrayList<Object>();
  if (parent != null && parent.getSchema() != null && parent.getSchema().getSchemaForSchema() != null) {
    if (!parent.getSchema().getSchemaForSchema().getTypeDefinitions().contains(parent))     list.add(parent.getBaseTypeDefinition());
  }
  list.addAll(parent.getFacetContents());
  return list.toArray(new Object[list.size()]);
}

Fixed version (ground truth):
private Object[] getXSDSimpleTypeDefinitionChildren_ATOMIC(XSDSimpleTypeDefinition parent){
  ArrayList<Object> list=new ArrayList<Object>();
  if (parent != null && parent.getSchema() != null && parent.getSchema().getSchemaForSchema() != null) {
    if (!parent.getSchema().getSchemaForSchema().getTypeDefinitions().contains(parent))     list.add(parent.getBaseTypeDefinition());
  }
  if (!Util.isBuildInType(parent))   list.addAll(parent.getFacetContents());
  return list.toArray(new Object[list.size()]);
}
Program: 148496
Project: 148496
Buggy source:
public static boolean isBuildInType(XSDSchema schema,XSDSimpleTypeDefinition type){
  return getAllBuildInTypes(schema).contains(type);
}

Fixed version (ground truth):
public static boolean isBuildInType(XSDSimpleTypeDefinition type){
  return getAllBuildInTypes(type.getSchema()).contains(type);
}
Program: 148497
Project: 148497
Buggy source:
public String isValid(String newText){
  if ((newText == null) || "String_Node_Str".equals(newText))   return "String_Node_Str";
  for (  XSDIdentityConstraintDefinition eachId : schema.getIdentityConstraintDefinitions()) {
    if (eachId.getName().equals(newText))     return "String_Node_Str";
  }
  return null;
}

Fixed version (ground truth):
public String isValid(String newText){
  if ((newText == null) || "String_Node_Str".equals(newText))   return "String_Node_Str";
  if (XSDIdentityConstraintCategory.UNIQUE_LITERAL.equals(key.getIdentityConstraintCategory()) && !newText.equals(((XSDElementDeclaration)key.getContainer()).getName())) {
    return "String_Node_Str";
  }
  for (  XSDIdentityConstraintDefinition eachId : getSchema().getIdentityConstraintDefinitions()) {
    if (eachId.getName().equals(newText))     return "String_Node_Str";
  }
  return null;
}
Program: 148498
Project: 148498
Buggy source:
public EditXSDIdentityConstraintNameValidator(XSDSchema schema){
  this.schema=schema;
}

Fixed version (ground truth):
public EditXSDIdentityConstraintNameValidator(XSDIdentityConstraintDefinition key){
  this.key=key;
}
Program: 148499
Project: 148499
Buggy source:
public XSDSchema getSchema(){
  return schema;
}

Fixed version (ground truth):
public XSDSchema getSchema(){
  return key.getSchema();
}
Program: 148503
Project: 148503
Buggy source:
public void modifyText(ModifyEvent e){
  if (descriptionValue != null && !descriptionValue.equals(descriptionText.getText())) {
    accommodation.markDirtyWithoutCommit();
  }
  descriptionValue=descriptionText.getText();
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  if (descriptionValue != null && !descriptionValue.equals(descriptionText.getText())) {
    if (accommodation != null)     accommodation.markDirtyWithoutCommit();
  }
  descriptionValue=descriptionText.getText();
}
Program: 148508
Project: 148508
Buggy source:
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (file.exists())   file.delete(true,null);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,null);
  return file;
}

Fixed version (ground truth):
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,null);
 else   sycFileContents(file,content);
  return file;
}
Program: 148509
Project: 148509
Buggy source:
public void widgetSelected(SelectionEvent e){
  AnnotationLanguageLabelsDialog dlg=(AnnotationLanguageLabelsDialog)((Widget)e.getSource()).getData("String_Node_Str");
  if (dlg.getReturnCode() == Window.OK) {
    String outPut="String_Node_Str";
    for (    Map.Entry<String,String> m : dataStore.entrySet()) {
      outPut+="String_Node_Str" + m.getKey().toUpperCase() + "String_Node_Str"+ m.getValue()+ "String_Node_Str";
    }
    if (!outPut.equals(descriptionText.getText())) {
      descriptionText.setText(outPut);
      accommodation.markDirtyWithoutCommit();
    }
  }
  dlg.close();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  AnnotationLanguageLabelsDialog dlg=(AnnotationLanguageLabelsDialog)((Widget)e.getSource()).getData("String_Node_Str");
  if (dlg.getReturnCode() == Window.OK) {
    String outPut="String_Node_Str";
    for (    Map.Entry<String,String> m : dataStore.entrySet()) {
      outPut+="String_Node_Str" + m.getKey().toUpperCase() + "String_Node_Str"+ m.getValue()+ "String_Node_Str";
    }
    if (!outPut.equals(descriptionText.getText())) {
      descriptionText.setText(outPut);
      if (accommodation != null)       accommodation.markDirtyWithoutCommit();
    }
  }
  dlg.close();
}
Program: 148511
Project: 148511
Buggy source:
public void modifyText(ModifyEvent e){
  if (descriptionValue != null && !descriptionValue.equals(descriptionText.getText())) {
    accommodation.markDirtyWithoutCommit();
  }
  descriptionValue=descriptionText.getText();
  fillDataStore(descriptionText.getText());
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  if (accommodation != null && descriptionValue != null && !descriptionValue.equals(descriptionText.getText())) {
    accommodation.markDirtyWithoutCommit();
  }
  descriptionValue=descriptionText.getText();
  fillDataStore(descriptionText.getText());
}
Program: 148512
Project: 148512
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;
  }
  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;
}

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);
    return doChangeElementTypeToSequence((XSDComplexTypeDefinition)parent.getTypeDefinition(),maxOccurs);
  }
 else {
    if (Util.getParent(decl) instanceof XSDComplexTypeDefinition) {
      return doChangeElementTypeToSequence((XSDComplexTypeDefinition)Util.getParent(decl),maxOccurs);
    }
  }
  return Status.OK_STATUS;
}
Program: 148513
Project: 148513
Buggy source:
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,null);
  return file;
}

Fixed version (ground truth):
public static IFile createFile(TreeObject xobject) throws Exception {
  WSDataModel wsDataModel=(WSDataModel)xobject.getWsObject();
  String filename=xobject.getDisplayName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  String content=wsDataModel.getXsdSchema();
  IProject project=createProject(xobject);
  String path=getXObjectPath(xobject);
  int pos=path.indexOf('/');
  String folder=path.substring(0,pos);
  IFolder fold=project.getFolder(folder);
  if (!fold.exists()) {
    fold.create(true,true,null);
  }
  IFile file=fold.getFile(filename);
  if (file.exists())   file.delete(true,null);
  if (!file.exists())   file.create(new ByteArrayInputStream(content.getBytes()),IFile.FORCE,null);
  return file;
}