nus-yam/ex-repair huggingface dataset:
Program: 120628
Project: 120628
Buggy source:
/** 
 * DOC ocarbone Comment method "checkField".
 */
protected void checkFieldsValue(){
  if (nameText.getText().length() == 0) {
    technicalNameText.setText("String_Node_Str");
    nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
  }
 else {
    if (!nameText.getText().endsWith("String_Node_Str")) {
      technicalNameText.setText(Project.createTechnicalName(nameText.getText()));
    }
    if (!Pattern.matches(RepositoryConstants.PROJECT_PATTERN,nameText.getText()) || isKeywords(nameText.getText().toLowerCase()) || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
      nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
    }
 else {
      if (isProjectNameAlreadyUsed(nameText.getText())) {
        nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
      }
 else {
        nameStatus=createOkStatus();
        descriptionStatus=createOkStatus();
        if (!languageJavaRadio.getSelection() && !languagePerlRadio.getSelection()) {
          languageStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
        }
 else         if (!languageEnable(getLanguage())) {
          languageStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.WARNING,Messages.getString("String_Node_Str",getLanguage()),null);
        }
 else {
          languageStatus=createOkStatus();
        }
      }
    }
  }
  updatePageStatus();
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "checkField".
 */
protected void checkFieldsValue(){
  if (nameText.getText().length() == 0) {
    technicalNameText.setText("String_Node_Str");
    nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
  }
 else {
    if (!nameText.getText().endsWith("String_Node_Str")) {
      technicalNameText.setText(Project.createTechnicalName(nameText.getText()));
    }
    if (ProjectUtils.isValidProjectName(nameText.getText())) {
      nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
    }
 else {
      if (isProjectNameAlreadyUsed(nameText.getText())) {
        nameStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
      }
 else {
        nameStatus=createOkStatus();
        descriptionStatus=createOkStatus();
        if (!languageJavaRadio.getSelection() && !languagePerlRadio.getSelection()) {
          languageStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.OK,Messages.getString("String_Node_Str"),null);
        }
 else         if (!languageEnable(getLanguage())) {
          languageStatus=new Status(IStatus.ERROR,RepositoryPlugin.PLUGIN_ID,IStatus.WARNING,Messages.getString("String_Node_Str",getLanguage()),null);
        }
 else {
          languageStatus=createOkStatus();
        }
      }
    }
  }
  updatePageStatus();
}
Program: 120629
Project: 120629
Buggy source:
/** 
 * Constructs a new NewProjectWizardPage.
 * @param server
 * @param password
 * @param author
 */
public NewProjectWizardPage(){
  super("String_Node_Str");
  setTitle(Messages.getString("String_Node_Str"));
  setDescription(Messages.getString("String_Node_Str"));
  initKeyWords();
  nameStatus=createOkStatus();
  descriptionStatus=createOkStatus();
  languageStatus=createOkStatus();
}

Fixed version (ground truth):
/** 
 * Constructs a new NewProjectWizardPage.
 * @param server
 * @param password
 * @param author
 */
public NewProjectWizardPage(){
  super("String_Node_Str");
  setTitle(Messages.getString("String_Node_Str"));
  setDescription(Messages.getString("String_Node_Str"));
  nameStatus=createOkStatus();
  descriptionStatus=createOkStatus();
  languageStatus=createOkStatus();
}
Program: 120630
Project: 120630
Buggy source:
@Override public void run(){
  List<FOXTreeNode> newInput=new ArrayList<FOXTreeNode>();
  String filePath=getFilePath();
  if (filePath == null) {
    return;
  }
  boolean changed=true;
  try {
    if (XmlUtil.isXSDFile(filePath)) {
      XSDSchema xsdSchema=TreeUtil.getXSDSchema(filePath);
      List<ATreeNode> list=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
      if (list.size() > 1) {
        RootNodeSelectDialog dialog=new RootNodeSelectDialog(xmlViewer.getControl().getShell(),list);
        if (dialog.open() == IDialogConstants.OK_ID) {
          ATreeNode selectedNode=dialog.getSelectedNode();
          newInput=TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,selectedNode);
          changed=true;
        }
 else {
          changed=false;
        }
      }
 else {
        newInput=TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,list.get(0));
        changed=true;
      }
    }
 else {
      newInput=treeNodeAdapt(filePath);
      changed=true;
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  if (newInput.size() == 0) {
    return;
  }
  if (changed) {
    List<FOXTreeNode> treeData=foxui.getFoxManager().getTreeData(getSelectedSchema());
    treeData.clear();
    treeData.addAll(newInput);
    xmlViewer.setInput(foxui.getFoxManager().getTreeData());
    xmlViewer.refresh();
    xmlViewer.expandToLevel(3);
    foxui.updateStatus();
    foxui.redrawLinkers();
  }
}

Fixed version (ground truth):
@Override public void run(){
  List<FOXTreeNode> newInput=new ArrayList<FOXTreeNode>();
  String filePath=getFilePath();
  if (filePath == null) {
    return;
  }
  boolean changed=true;
  try {
    if (XmlUtil.isXSDFile(filePath)) {
      XSDSchema xsdSchema=TreeUtil.getXSDSchema(filePath);
      List<ATreeNode> list=new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
      if (list.size() > 1) {
        RootNodeSelectDialog dialog=new RootNodeSelectDialog(xmlViewer.getControl().getShell(),list);
        if (dialog.open() == IDialogConstants.OK_ID) {
          ATreeNode selectedNode=dialog.getSelectedNode();
          newInput=TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,selectedNode);
          changed=true;
        }
 else {
          changed=false;
        }
      }
 else {
        newInput=TreeUtil.getFoxTreeNodesByRootNode(xsdSchema,list.get(0));
        changed=true;
      }
    }
 else {
      newInput=treeNodeAdapt(filePath);
      changed=true;
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  if (newInput.size() == 0) {
    return;
  }
  if (changed) {
    for (    FOXTreeNode node : newInput) {
      foxui.updateNode(node,getSelectedSchema());
    }
    List<FOXTreeNode> treeData=foxui.getFoxManager().getTreeData(getSelectedSchema());
    treeData.clear();
    treeData.addAll(newInput);
    xmlViewer.setInput(foxui.getFoxManager().getTreeData());
    xmlViewer.refresh();
    xmlViewer.expandToLevel(3);
    foxui.updateStatus();
    foxui.redrawLinkers();
  }
}
Program: 120631
Project: 120631
Buggy source:
public static InputStreamMerger bulkload(String url,String cluster,String concept,String dataModel,boolean validate,boolean smartPK,String username,String password,String transactionId,String universe,AtomicInteger startedBulkloadCount){
  InputStreamMerger merger=new InputStreamMerger();
  Runnable loadRunnable=new AsyncLoadRunnable(url,cluster,concept,dataModel,validate,smartPK,merger,username,password,universe,transactionId,startedBulkloadCount);
  Thread loadThread=new Thread(loadRunnable);
  loadThread.start();
  return merger;
}

Fixed version (ground truth):
public static InputStreamMerger bulkload(String url,String cluster,String concept,String dataModel,boolean validate,boolean smartPK,String username,String password,String transactionId,String universe,AtomicInteger startedBulkloadCount){
  InputStreamMerger merger=new InputStreamMerger();
  Runnable loadRunnable=new AsyncLoadRunnable(url,cluster,concept,dataModel,validate,smartPK,merger,username,password,transactionId,universe,startedBulkloadCount);
  Thread loadThread=new Thread(loadRunnable);
  loadThread.start();
  return merger;
}
Program: 120633
Project: 120633
Buggy source:
public void transform(NodeType node){
  ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (dbType != null) {
    if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
      ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
      if (schema_db != null && !"String_Node_Str".equals(schema_db.getValue())) {
        ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void transform(NodeType node){
  ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (dbType != null) {
    if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
      ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
      if (schema_db != null) {
        ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
      }
    }
  }
}
Program: 120634
Project: 120634
Buggy source:
public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2013,8,29,12,0,0);
  return gc.getTime();
}

Fixed version (ground truth):
public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2013,8,30,12,0,0);
  return gc.getTime();
}
Program: 120635
Project: 120635
Buggy source:
@Override public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  IComponentFilter filter=new NameComponentFilter("String_Node_Str");
  try {
    ModifyComponentsAction.searchAndModify(item,processType,filter,Arrays.<IComponentConversion>asList(new IComponentConversion(){
      public void transform(      NodeType node){
        ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
        if (dbType != null) {
          if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
            ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
            if (schema_db != null && !"String_Node_Str".equals(schema_db.getValue())) {
              ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
            }
          }
        }
      }
    }
));
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  IComponentFilter filter=new NameComponentFilter("String_Node_Str");
  try {
    ModifyComponentsAction.searchAndModify(item,processType,filter,Arrays.<IComponentConversion>asList(new IComponentConversion(){
      public void transform(      NodeType node){
        ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
        if (dbType != null) {
          if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
            ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
            if (schema_db != null) {
              ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
            }
          }
        }
      }
    }
));
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}
Program: 120638
Project: 120638
Buggy source:
public void transform(NodeType node){
  ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (dbType != null) {
    if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
      ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
      if (schema_db != null && !"String_Node_Str".equals(schema_db.getValue())) {
        ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void transform(NodeType node){
  ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (dbType != null) {
    if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
      ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
      if (schema_db != null) {
        ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
      }
    }
  }
}
Program: 120639
Project: 120639
Buggy source:
@Override public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  IComponentFilter filter=new NameComponentFilter("String_Node_Str");
  try {
    ModifyComponentsAction.searchAndModify(item,processType,filter,Arrays.<IComponentConversion>asList(new IComponentConversion(){
      public void transform(      NodeType node){
        ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
        if (dbType != null) {
          if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
            ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
            if (schema_db != null && !"String_Node_Str".equals(schema_db.getValue())) {
              ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
            }
          }
        }
      }
    }
));
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  IComponentFilter filter=new NameComponentFilter("String_Node_Str");
  try {
    ModifyComponentsAction.searchAndModify(item,processType,filter,Arrays.<IComponentConversion>asList(new IComponentConversion(){
      public void transform(      NodeType node){
        ElementParameterType dbType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
        if (dbType != null) {
          if ("String_Node_Str".equals(dbType.getValue()) || "String_Node_Str".equals(dbType.getValue())) {
            ElementParameterType schema_db=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
            if (schema_db != null) {
              ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
            }
          }
        }
      }
    }
));
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}
Program: 120641
Project: 120641
Buggy source:
public TableEntryLocation findUniqueLocation(final TableEntryLocation proposedLocation,String[] columnsBeingCreated){
  TableEntryLocation tableEntryLocation=new TableEntryLocation(proposedLocation);
  int counter=1;
  boolean exists=true;
  while (exists) {
    exists=retrieveTableEntry(tableEntryLocation) != null;
    if (!exists) {
      for (int i=0; i < columnsBeingCreated.length; i++) {
        String columnBeingCreated=columnsBeingCreated[i];
        if (columnBeingCreated.equals(tableEntryLocation.columnName)) {
          exists=true;
          break;
        }
      }
    }
    if (!exists) {
      break;
    }
    tableEntryLocation.columnName=proposedLocation.columnName + "String_Node_Str" + counter++;
  }
  return tableEntryLocation;
}

Fixed version (ground truth):
public TableEntryLocation findUniqueLocation(final TableEntryLocation proposedLocation){
  TableEntryLocation tableEntryLocation=new TableEntryLocation(proposedLocation);
  int counter=1;
  boolean exists=true;
  while (exists) {
    boolean found=false;
    IDataMapTable table=getTableByName(tableEntryLocation.tableName);
    if (table != null) {
      List<IColumnEntry> entryExisted=table.getColumnEntries();
      for (      IColumnEntry entry : entryExisted) {
        if (entry.getName().equalsIgnoreCase(tableEntryLocation.columnName)) {
          found=true;
          break;
        }
      }
    }
    exists=found;
    if (!exists) {
      break;
    }
    tableEntryLocation.columnName=proposedLocation.columnName + "String_Node_Str" + counter++;
  }
  return tableEntryLocation;
}
Program: 120643
Project: 120643
Buggy source:
public TableEntryLocation findUniqueLocation(final TableEntryLocation proposedLocation,String[] columnsBeingCreated){
  TableEntryLocation tableEntryLocation=new TableEntryLocation(proposedLocation);
  int counter=1;
  boolean exists=true;
  while (exists) {
    exists=retrieveTableEntry(tableEntryLocation) != null;
    if (!exists) {
      for (      String columnBeingCreated : columnsBeingCreated) {
        if (columnBeingCreated.equals(tableEntryLocation.columnName)) {
          exists=true;
          break;
        }
      }
    }
    if (!exists) {
      break;
    }
    tableEntryLocation.columnName=proposedLocation.columnName + "String_Node_Str" + counter++;
  }
  return tableEntryLocation;
}

Fixed version (ground truth):
public TableEntryLocation findUniqueLocation(final TableEntryLocation proposedLocation){
  TableEntryLocation tableEntryLocation=new TableEntryLocation(proposedLocation);
  int counter=1;
  boolean exists=true;
  while (exists) {
    boolean found=false;
    IDataMapTable table=getTableByName(tableEntryLocation.tableName);
    if (table != null) {
      List<IColumnEntry> entryExisted=table.getColumnEntries();
      for (      IColumnEntry entry : entryExisted) {
        if (entry.getName().equalsIgnoreCase(tableEntryLocation.columnName)) {
          found=true;
          break;
        }
      }
    }
    exists=found;
    if (!exists) {
      break;
    }
    tableEntryLocation.columnName=proposedLocation.columnName + "String_Node_Str" + counter++;
  }
  return tableEntryLocation;
}
Program: 120645
Project: 120645
Buggy source:
private String getUniqueTableEntry(List<? extends AbstractNode> nodeExisted,String nameToCreate){
  boolean exists=true;
  int counter=1;
  String newName=nameToCreate;
  while (exists) {
    boolean found=false;
    for (    AbstractNode node : nodeExisted) {
      if (node.getName().equals(newName)) {
        found=true;
        break;
      }
    }
    exists=found;
    if (!exists) {
      break;
    }
    newName=nameToCreate + "String_Node_Str" + counter++;
  }
  return newName;
}

Fixed version (ground truth):
private String getUniqueTableEntry(List<? extends AbstractNode> nodeExisted,String nameToCreate){
  boolean exists=true;
  int counter=1;
  String newName=nameToCreate;
  while (exists) {
    boolean found=false;
    for (    AbstractNode node : nodeExisted) {
      if (node.getName().equalsIgnoreCase(newName)) {
        found=true;
        break;
      }
    }
    exists=found;
    if (!exists) {
      break;
    }
    newName=nameToCreate + "String_Node_Str" + counter++;
  }
  return newName;
}
Program: 120653
Project: 120653
Buggy source:
public void run(final IProgressMonitor monitor) throws CoreException {
  if (!alreadyEditedByUser) {
    getProperty().setVersion(mainPage.getNewVersion());
    refreshNewJob();
    try {
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
  try {
    Item newCreated=null;
    if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
      newCreated=processObject.getProperty().getItem();
    }
    if (!(newCreated instanceof BusinessProcessItem)) {
      ProxyRepositoryFactory.getInstance().lock(processObject);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
catch (  LoginException e) {
    ExceptionHandler.process(e);
  }
  boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
  openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
  try {
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override public void run(final IProgressMonitor monitor) throws CoreException {
  if (!alreadyEditedByUser) {
    getProperty().setVersion(mainPage.getNewVersion());
    refreshNewJob();
    try {
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
  try {
    Item newCreated=null;
    if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
      newCreated=processObject.getProperty().getItem();
    }
    if (!(newCreated instanceof BusinessProcessItem)) {
      ProxyRepositoryFactory.getInstance().lock(processObject);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
catch (  LoginException e) {
    ExceptionHandler.process(e);
  }
  boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
  openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
  try {
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 120654
Project: 120654
Buggy source:
protected boolean refreshNewJob(){
  if (alreadyEditedByUser) {
    return false;
  }
  StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
  if (selection != null && selection.isEmpty()) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    boolean lastVersion=node.getObject().getVersion().equals(originalVersion);
    if (!lastVersion) {
      originalVersion=node.getObject().getVersion();
      String newVersion=processObject.getVersion();
      processObject=node.getObject();
      processObject.getProperty().setVersion(newVersion);
    }
  }
  IProxyRepositoryFactory repositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
  try {
    repositoryFactory.save(getProperty(),this.originaleObjectLabel,this.originalVersion);
    ExpressionPersistance.getInstance().jobNameChanged(originaleObjectLabel,processObject.getLabel());
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    return true;
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
}

Fixed version (ground truth):
protected boolean refreshNewJob(){
  if (alreadyEditedByUser) {
    return false;
  }
  StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
  if (selection != null && !selection.isEmpty()) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    boolean lastVersion=node.getObject().getVersion().equals(originalVersion);
    if (!lastVersion) {
      originalVersion=node.getObject().getVersion();
      String newVersion=processObject.getVersion();
      processObject=node.getObject();
      processObject.getProperty().setVersion(newVersion);
    }
  }
  IProxyRepositoryFactory repositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
  try {
    repositoryFactory.save(getProperty(),this.originaleObjectLabel,this.originalVersion);
    ExpressionPersistance.getInstance().jobNameChanged(originaleObjectLabel,processObject.getLabel());
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    return true;
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
}
Program: 120661
Project: 120661
Buggy source:
public void init(ICommonActionExtensionSite anExtensionSite){
  if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
    copyProjectAction=new PushToPaletteAction();
  }
}

Fixed version (ground truth):
@Override public void init(ICommonActionExtensionSite anExtensionSite){
  if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
    copyProjectAction=new PushToPaletteAction();
  }
}
Program: 120662
Project: 120662
Buggy source:
private List<String> checkComponentXMLinFolder(String folderPath){
  List<String> invalidXMLs=new ArrayList();
  File componentFolder=new File(folderPath);
  File[] list=componentFolder.listFiles(new FilenameFilter(){
    public boolean accept(    File dir,    String name){
      String javaXmlName=dir.getName() + "String_Node_Str";
      String perlXmlName=dir.getName() + "String_Node_Str";
      if (name.equals(javaXmlName) || name.equals(perlXmlName)) {
        return true;
      }
      return false;
    }
  }
);
  if (list != null) {
    for (    File xmlFile : list) {
      try {
        String message=new XSDValidator().checkXSD(xmlFile.getCanonicalPath());
        if (message.length() > 0) {
          invalidXMLs.add(xmlFile.getName());
        }
      }
 catch (      Exception e) {
        org.talend.componentdesigner.exception.ExceptionHandler.process(e);
      }
    }
  }
  return invalidXMLs;
}

Fixed version (ground truth):
private List<String> checkComponentXMLinFolder(String folderPath){
  List<String> invalidXMLs=new ArrayList();
  File componentFolder=new File(folderPath);
  File[] list=componentFolder.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File dir,    String name){
      String javaXmlName=dir.getName() + "String_Node_Str";
      String perlXmlName=dir.getName() + "String_Node_Str";
      if (name.equals(javaXmlName) || name.equals(perlXmlName)) {
        return true;
      }
      return false;
    }
  }
);
  if (list != null) {
    for (    File xmlFile : list) {
      try {
        String message=new XSDValidator().checkXSD(xmlFile.getCanonicalPath());
        if (message.length() > 0) {
          invalidXMLs.add(xmlFile.getName());
        }
      }
 catch (      Exception e) {
        org.talend.componentdesigner.exception.ExceptionHandler.process(e);
      }
    }
  }
  return invalidXMLs;
}
Program: 120663
Project: 120663
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  menu.insertBefore("String_Node_Str",copyProjectAction);
  Iterator ite=((TreeSelection)this.getContext().getSelection()).iterator();
  selectedFolderList=new ArrayList<IFolder>();
  while (ite.hasNext()) {
    Object obj=ite.next();
    if (obj instanceof IFolder) {
      selectedFolderList.add((IFolder)obj);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
@Override public void fillContextMenu(IMenuManager menu){
  menu.insertBefore("String_Node_Str",copyProjectAction);
  Iterator ite=((TreeSelection)this.getContext().getSelection()).iterator();
  selectedFolderList=new ArrayList<IFolder>();
  while (ite.hasNext()) {
    Object obj=ite.next();
    if (obj instanceof IFolder) {
      selectedFolderList.add((IFolder)obj);
    }
  }
}
Program: 120665
Project: 120665
Buggy source:
public boolean accept(File dir,String name){
  String javaXmlName=dir.getName() + "String_Node_Str";
  String perlXmlName=dir.getName() + "String_Node_Str";
  if (name.equals(javaXmlName) || name.equals(perlXmlName)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean accept(File dir,String name){
  String javaXmlName=dir.getName() + "String_Node_Str";
  String perlXmlName=dir.getName() + "String_Node_Str";
  if (name.equals(javaXmlName) || name.equals(perlXmlName)) {
    return true;
  }
  return false;
}
Program: 120666
Project: 120666
Buggy source:
public void initCategoryCombo(){
  if (categoryCombo.getItemCount() > 0) {
    return;
  }
  for (  Category category : fCategorys) {
    if ("String_Node_Str".equals(category.getCategoryName()) || "String_Node_Str".equals(category.getCategoryName())) {
      continue;
    }
    categoryCombo.add(category.getCategoryName());
  }
  categoryCombo.select(0);
  categoryCombo.pack();
}

Fixed version (ground truth):
public void initCategoryCombo(){
  if (categoryCombo.getItemCount() > 0) {
    return;
  }
  Iterator<Category> cListIterator=fCategorys.iterator();
  while (cListIterator.hasNext()) {
    Category category=cListIterator.next();
    if ("String_Node_Str".equals(category.getCategoryName()) || "String_Node_Str".equals(category.getCategoryName())) {
      cListIterator.remove();
      continue;
    }
    categoryCombo.add(category.getCategoryName());
  }
  categoryCombo.select(0);
  categoryCombo.pack();
}
Program: 120669
Project: 120669
Buggy source:
@Override public boolean performOk(){
  boolean ok=super.performOk();
  if (templateTxt != null && !templateTxt.isDisposed()) {
    IRunProcessService service=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
      service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
    }
    if (reset) {
      if (service != null) {
        Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE,String.valueOf(false));
        Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE,service.getLogTemplate(Log4jPrefsConstants.LOG4JFILEPATH));
      }
    }
 else {
      Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE,String.valueOf(log4jBtn.getSelection()));
      Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE,templateTxt.getText());
    }
    reset=false;
    updateLogFiles();
  }
  return ok;
}

Fixed version (ground truth):
@Override public boolean performOk(){
  boolean ok=super.performOk();
  if (templateTxt != null && !templateTxt.isDisposed()) {
    IRunProcessService service=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
      service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
    }
    if (reset) {
      if (service != null) {
        Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE,String.valueOf(false));
        Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE,service.getLogTemplate(Log4jPrefsConstants.LOG4JFILEPATH));
      }
    }
 else {
      Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE,String.valueOf(log4jBtn.getSelection()));
      Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE,templateTxt.getText());
    }
    reset=false;
  }
  return ok;
}
Program: 120673
Project: 120673
Buggy source:
private Composite createLog4jGroup(Composite parent){
  Group log4jGroup=new Group(parent,SWT.NONE);
  log4jGroup.setText("String_Node_Str");
  GridLayout log4jGroupLayout=new GridLayout();
  log4jGroupLayout.marginHeight=0;
  log4jGroupLayout.marginWidth=0;
  log4jGroupLayout.numColumns=2;
  log4jGroup.setLayout(log4jGroupLayout);
  FormData log4jGroupLayouData=new FormData();
  log4jGroupLayouData.left=new FormAttachment(0,10);
  log4jGroupLayouData.right=new FormAttachment(100,0);
  log4jGroupLayouData.top=new FormAttachment(0,200);
  log4jGroupLayouData.bottom=new FormAttachment(210,0);
  log4jGroup.setLayoutData(log4jGroupLayouData);
  log4jLevel=new Combo(log4jGroup,SWT.READ_ONLY);
  log4jLevel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
  log4jLevel.setText("String_Node_Str");
  log4jLevel.setBackground(log4jGroup.getBackground());
  log4jLevel.setItems(getListToDisplay());
  log4jLevel.select(0);
  applyLog4jForChild=new Button(log4jGroup,SWT.CHECK);
  applyLog4jForChild.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
  applyLog4jForChild.setText("String_Node_Str");
  applyLog4jForChild.setToolTipText("String_Node_Str");
  return log4jGroup;
}

Fixed version (ground truth):
private Composite createLog4jGroup(Composite parent){
  Group log4jGroup=new Group(parent,SWT.NONE);
  log4jGroup.setText("String_Node_Str");
  GridLayout log4jGroupLayout=new GridLayout();
  log4jGroupLayout.marginHeight=0;
  log4jGroupLayout.marginWidth=0;
  log4jGroupLayout.numColumns=2;
  log4jGroup.setLayout(log4jGroupLayout);
  FormData log4jGroupLayouData=new FormData();
  log4jGroupLayouData.left=new FormAttachment(0,10);
  log4jGroupLayouData.right=new FormAttachment(100,0);
  log4jGroupLayouData.top=new FormAttachment(0,200);
  log4jGroupLayouData.bottom=new FormAttachment(210,0);
  log4jGroup.setLayoutData(log4jGroupLayouData);
  log4jLevel=new Combo(log4jGroup,SWT.READ_ONLY);
  log4jLevel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
  log4jLevel.setText("String_Node_Str");
  log4jLevel.setBackground(log4jGroup.getBackground());
  log4jLevel.setItems(Log4jPrefsSettingManager.getLevel());
  log4jLevel.select(0);
  applyLog4jForChild=new Button(log4jGroup,SWT.CHECK);
  applyLog4jForChild.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
  applyLog4jForChild.setText("String_Node_Str");
  applyLog4jForChild.setToolTipText("String_Node_Str");
  return log4jGroup;
}
Program: 120674
Project: 120674
Buggy source:
private void collectNodes(Map<String,Item> items,RepositoryNode repositoryNode){
  IRepositoryViewObject repositoryObject=repositoryNode.getObject();
  if (repositoryObject != null) {
    if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
      Item item=repositoryObject.getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
 else {
    if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
      Item item=repositoryNode.getParent().getObject().getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
  if (filteredCheckboxTree != null) {
    IContentProvider contentProvider=filteredCheckboxTree.getViewer().getContentProvider();
    if (contentProvider instanceof ITreeContentProvider) {
      Object[] children=((ITreeContentProvider)contentProvider).getChildren(repositoryNode);
      collectNodes(items,children);
    }
  }
}

Fixed version (ground truth):
private void collectNodes(Map<String,Item> items,RepositoryNode repositoryNode){
  IRepositoryViewObject repositoryObject=repositoryNode.getObject();
  if (repositoryObject != null) {
    if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
      Item item=repositoryObject.getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
 else {
    if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
      Item item=repositoryNode.getParent().getObject().getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
  if (filteredCheckboxTree != null && !isHadoopClusterNode(repositoryNode)) {
    IContentProvider contentProvider=filteredCheckboxTree.getViewer().getContentProvider();
    if (contentProvider instanceof ITreeContentProvider) {
      Object[] children=((ITreeContentProvider)contentProvider).getChildren(repositoryNode);
      collectNodes(items,children);
    }
  }
}
Program: 120675
Project: 120675
Buggy source:
protected boolean selectRepositoryNode(Viewer viewer,RepositoryNode node){
  if (node == null) {
    return false;
  }
  IRepositoryViewObject object=node.getObject();
  if (object != null) {
    if (object instanceof MetadataColumnRepositoryObject) {
      return false;
    }
    if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
      return false;
    }
  }
  if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
    return false;
  }
  if (object == null && ERepositoryObjectType.GENERATED.equals(node.getContentType())) {
    return false;
  }
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService != null) {
    return !hadoopClusterService.isHadoopSubnode(node);
  }
  return true;
}

Fixed version (ground truth):
protected boolean selectRepositoryNode(Viewer viewer,RepositoryNode node){
  if (node == null) {
    return false;
  }
  IRepositoryViewObject object=node.getObject();
  if (object != null) {
    if (object instanceof MetadataColumnRepositoryObject) {
      return false;
    }
    if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
      return false;
    }
  }
  if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
    return false;
  }
  if (object == null && ERepositoryObjectType.GENERATED.equals(node.getContentType())) {
    return false;
  }
  return true;
}
Program: 120676
Project: 120676
Buggy source:
private void collectNodes(Map<String,Item> items,RepositoryNode repositoryNode){
  IRepositoryViewObject repositoryObject=repositoryNode.getObject();
  if (repositoryObject != null) {
    if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
      Item item=repositoryObject.getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
 else {
    if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
      Item item=repositoryNode.getParent().getObject().getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
  if (filteredCheckboxTree != null) {
    IContentProvider contentProvider=filteredCheckboxTree.getViewer().getContentProvider();
    if (contentProvider instanceof ITreeContentProvider) {
      Object[] children=((ITreeContentProvider)contentProvider).getChildren(repositoryNode);
      collectNodes(items,children);
    }
  }
}

Fixed version (ground truth):
private void collectNodes(Map<String,Item> items,RepositoryNode repositoryNode){
  IRepositoryViewObject repositoryObject=repositoryNode.getObject();
  if (repositoryObject != null) {
    if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
      Item item=repositoryObject.getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
 else {
    if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
      Item item=repositoryNode.getParent().getObject().getProperty().getItem();
      items.put(item.getProperty().getId(),item);
    }
  }
  if (filteredCheckboxTree != null && !isHadoopClusterNode(repositoryNode)) {
    IContentProvider contentProvider=filteredCheckboxTree.getViewer().getContentProvider();
    if (contentProvider instanceof ITreeContentProvider) {
      Object[] children=((ITreeContentProvider)contentProvider).getChildren(repositoryNode);
      collectNodes(items,children);
    }
  }
}
Program: 120677
Project: 120677
Buggy source:
protected boolean selectRepositoryNode(Viewer viewer,RepositoryNode node){
  if (node == null) {
    return false;
  }
  IRepositoryViewObject object=node.getObject();
  if (object != null) {
    if (object instanceof MetadataColumnRepositoryObject) {
      return false;
    }
    if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
      return false;
    }
  }
  if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
    return false;
  }
  if (object == null && ERepositoryObjectType.GENERATED.equals(node.getContentType())) {
    return false;
  }
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService != null) {
    return !hadoopClusterService.isHadoopSubnode(node);
  }
  return true;
}

Fixed version (ground truth):
protected boolean selectRepositoryNode(Viewer viewer,RepositoryNode node){
  if (node == null) {
    return false;
  }
  IRepositoryViewObject object=node.getObject();
  if (object != null) {
    if (object instanceof MetadataColumnRepositoryObject) {
      return false;
    }
    if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
      return false;
    }
  }
  if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
    return false;
  }
  if (object == null && ERepositoryObjectType.GENERATED.equals(node.getContentType())) {
    return false;
  }
  return true;
}
Program: 120679
Project: 120679
Buggy source:
@Override public void handleEvent(Event event){
  if (event.getProperty(Constant.ITEM_EVENT_PROPERTY_KEY) != null) {
    boolean readOnly=currentProcess.checkReadOnly();
    setReadOnly(readOnly);
    if (!readOnly) {
      repFactory.addRepositoryWorkUnitListener(repositoryWorkListener);
      display.asyncExec(new Runnable(){
        @Override public void run(){
          setFocus();
        }
      }
);
      Property property=processEditorInput.getItem().getProperty();
      propertyInformation=new ArrayList(property.getInformations());
      property.eAdapters().add(dirtyListener);
    }
  }
}

Fixed version (ground truth):
@Override public void handleEvent(Event event){
  String lockTopic=Constant.REPOSITORY_ITEM_EVENT_PREFIX + Constant.ITEM_LOCK_EVENT_SUFFIX;
  if (lockTopic.equals(event.getTopic())) {
    Object o=event.getProperty(Constant.ITEM_EVENT_PROPERTY_KEY);
    if (o != null && o instanceof Item) {
      String itemId=((Item)o).getProperty().getId();
      if (itemId.equals(currentProcess.getId())) {
        if (currentProcess.isReadOnly()) {
          boolean readOnly=currentProcess.checkReadOnly();
          setReadOnly(readOnly);
          if (!readOnly) {
            display.asyncExec(new Runnable(){
              @Override public void run(){
                setFocus();
              }
            }
);
            Property property=processEditorInput.getItem().getProperty();
            propertyInformation=new ArrayList(property.getInformations());
            property.eAdapters().add(dirtyListener);
          }
        }
      }
    }
  }
}
Program: 120680
Project: 120680
Buggy source:
@Override public boolean isEnabled(DropTargetEvent e){
  Object obj=getSelection().getFirstElement();
  if (obj instanceof RepositoryNode) {
    RepositoryNode sourceNode=(RepositoryNode)obj;
    if (PluginChecker.isCDCPluginLoaded()) {
      ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
      if (service != null && (service.isSubscriberTableNode(sourceNode) || service.isSystemSubscriberTable(sourceNode))) {
        return false;
      }
    }
    IHadoopClusterService hadoopClusterService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
      hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
    }
    if (hadoopClusterService != null && hadoopClusterService.isHadoopClusterNode(sourceNode)) {
      return false;
    }
    IOozieService oozieService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IOozieService.class)) {
      oozieService=(IOozieService)GlobalServiceRegister.getDefault().getService(IOozieService.class);
    }
    if (oozieService != null && oozieService.isOozieNode(sourceNode)) {
      return false;
    }
  }
  return !this.editor.getProcess().isReadOnly();
}

Fixed version (ground truth):
@Override public boolean isEnabled(DropTargetEvent e){
  Object obj=getSelection().getFirstElement();
  if (obj instanceof RepositoryNode) {
    RepositoryNode sourceNode=(RepositoryNode)obj;
    if (PluginChecker.isCDCPluginLoaded()) {
      ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
      if (service != null && (service.isSubscriberTableNode(sourceNode) || service.isSystemSubscriberTable(sourceNode))) {
        return false;
      }
    }
    IHadoopClusterService hadoopClusterService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
      hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
    }
    if (hadoopClusterService != null && hadoopClusterService.isHadoopClusterNode(sourceNode)) {
      return false;
    }
    IOozieService oozieService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IOozieService.class)) {
      oozieService=(IOozieService)GlobalServiceRegister.getDefault().getService(IOozieService.class);
    }
    if (oozieService != null && oozieService.isOozieNode(sourceNode)) {
      return false;
    }
    ISAPProviderService sapService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISAPProviderService.class)) {
      sapService=(ISAPProviderService)GlobalServiceRegister.getDefault().getService(ISAPProviderService.class);
    }
    if (sapService != null && sapService.isSAPNode(sourceNode)) {
      return false;
    }
  }
  return !this.editor.getProcess().isReadOnly();
}