nus-yam/ex-repair huggingface dataset:
Program: 139813
Project: 139813
Buggy source:
/** 
 * DOC Zqin Comment method "runInDQViewer". this method open DQ responsitory view and run the specified query.
 * @param tdDataProvider
 * @param query
 */
public void runInDQViewer(TdDataProvider tdDataProvider,String query,String editorName){
  SQLEditor sqlEditor=openInSqlEditor(tdDataProvider,query,editorName);
  Session session=sqlEditor.getSession();
  if (sqlEditor != null && session != null) {
    new ExecSQLAction(sqlEditor).run();
  }
}

Fixed version (ground truth):
/** 
 * DOC Zqin Comment method "runInDQViewer". this method open DQ responsitory view and run the specified query.
 * @param tdDataProvider
 * @param query
 */
public void runInDQViewer(TdDataProvider tdDataProvider,String query,String editorName){
  SQLEditor sqlEditor=openInSqlEditor(tdDataProvider,query,editorName);
  if (sqlEditor != null) {
    new ExecSQLAction(sqlEditor).run();
  }
}
Program: 139814
Project: 139814
Buggy source:
@Override protected List<TdView> getColumnSetsWithFilter(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  if (schema != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,schema.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override protected List<TdView> getColumnSetsWithFilter(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  if (schema != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,schema.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(schema),viewFilter);
  }
  return Collections.emptyList();
}
Program: 139815
Project: 139815
Buggy source:
public List<ForeignKey> getForeignKeys(String catalogName,String schemaPattern,String tableName) throws SQLException {
  List<ForeignKey> pks=new ArrayList<ForeignKey>();
  ResultSet foreignKeys=connection.getMetaData().getImportedKeys(catalogName,schemaPattern,tableName);
  try {
    while (foreignKeys.next()) {
      ForeignKey pk=createForeignKey(foreignKeys);
      pks.add(pk);
    }
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    foreignKeys.close();
  }
  return pks;
}

Fixed version (ground truth):
public List<ForeignKey> getForeignKeys(String catalogName,String schemaPattern,String tableName) throws SQLException {
  List<ForeignKey> pks=new ArrayList<ForeignKey>();
  String driverName=connection.getMetaData().getDriverName();
  String dbLanguage=SupportDBUrlType.SQLITE3DEFAULTURL.getLanguage();
  if (!driverName.toLowerCase().contains(dbLanguage.toLowerCase())) {
    ResultSet foreignKeys=connection.getMetaData().getImportedKeys(catalogName,schemaPattern,tableName);
    try {
      while (foreignKeys.next()) {
        ForeignKey pk=createForeignKey(foreignKeys);
        pks.add(pk);
      }
    }
 catch (    SQLException e) {
      throw e;
    }
 finally {
      foreignKeys.close();
    }
  }
  return pks;
}
Program: 139816
Project: 139816
Buggy source:
private void fillDbUrlMap(){
  supportDBUrlMap.put(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MYSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MSSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDBKey(),SupportDBUrlType.DB2DEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDBKey(),SupportDBUrlType.POSTGRESQLEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.SYBASEDEFAULTURL.getDBKey(),SupportDBUrlType.SYBASEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.INGRESDEFAULTURL.getDBKey(),SupportDBUrlType.INGRESDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.INFORMIXDEFAULTURL.getDBKey(),SupportDBUrlType.INFORMIXDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.GENERICJDBCDEFAULTURL.getDBKey(),SupportDBUrlType.GENERICJDBCDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.TERADATADEFAULTURL.getDBKey(),SupportDBUrlType.TERADATADEFAULTURL);
}

Fixed version (ground truth):
private void fillDbUrlMap(){
  supportDBUrlMap.put(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MYSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MSSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDBKey(),SupportDBUrlType.DB2DEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDBKey(),SupportDBUrlType.POSTGRESQLEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.SYBASEDEFAULTURL.getDBKey(),SupportDBUrlType.SYBASEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.INGRESDEFAULTURL.getDBKey(),SupportDBUrlType.INGRESDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.INFORMIXDEFAULTURL.getDBKey(),SupportDBUrlType.INFORMIXDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.SQLITE3DEFAULTURL.getDBKey(),SupportDBUrlType.SQLITE3DEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.GENERICJDBCDEFAULTURL.getDBKey(),SupportDBUrlType.GENERICJDBCDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.TERADATADEFAULTURL.getDBKey(),SupportDBUrlType.TERADATADEFAULTURL);
}
Program: 139817
Project: 139817
Buggy source:
@Override protected List<TdView> getColumnSetsWithFilter(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  if (schema != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,schema.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(schema),viewFilter);
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override protected List<TdView> getColumnSetsWithFilter(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  if (schema != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,schema.getTaggedValue());
    return filterColumnSets(SchemaHelper.getViews(schema),viewFilter);
  }
  return Collections.emptyList();
}
Program: 139818
Project: 139818
Buggy source:
/** 
 * DOC scorreia Comment method "createInstantiatedSqlExpression".
 * @param sqlGenericExpression
 * @param columnSetA
 * @param columnSetB
 * @param useNulls
 * @return
 */
private Expression createInstantiatedSqlExpression(Expression sqlGenericExpression,EList<Column> columnSetA,EList<Column> columnSetB,boolean useNulls){
  String tableNameA=getTableName(columnSetA);
  String tableNameB=getTableName(columnSetB);
  String genericSQL=sqlGenericExpression.getBody();
  String joinClause=createJoinClause(tableNameA,columnSetA,tableNameB,columnSetB,useNulls);
  String whereClause=createWhereClause(tableNameB,columnSetB);
  if (useNulls) {
    whereClause+=dbms().and() + '(' + createNotNullCondition(tableNameA,columnSetA)+ ')';
  }
  String instantiatedSQL=dbms().fillGenericQueryWithJoin(genericSQL,tableNameA,tableNameB,joinClause,whereClause);
  Expression instantiatedExpression=CoreFactory.eINSTANCE.createExpression();
  instantiatedExpression.setLanguage(sqlGenericExpression.getLanguage());
  instantiatedExpression.setBody(instantiatedSQL);
  return instantiatedExpression;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "createInstantiatedSqlExpression".
 * @param sqlGenericExpression
 * @param columnSetA
 * @param columnSetB
 * @param useNulls
 * @return
 */
private Expression createInstantiatedSqlExpression(Expression sqlGenericExpression,EList<Column> columnSetA,EList<Column> columnSetB,boolean useNulls){
  String aliasA="String_Node_Str";
  String aliasB="String_Node_Str";
  String tableNameA=getTableName(columnSetA) + "String_Node_Str" + aliasA;
  String tableNameB=getTableName(columnSetB) + "String_Node_Str" + aliasB;
  String genericSQL=sqlGenericExpression.getBody();
  String joinClause=createJoinClause(aliasA,columnSetA,aliasB,columnSetB,useNulls);
  String whereClause=createWhereClause(aliasB,columnSetB);
  if (useNulls) {
    whereClause+=dbms().and() + '(' + createNotNullCondition(aliasA,columnSetA)+ ')';
  }
  String instantiatedSQL=dbms().fillGenericQueryWithJoin(genericSQL,tableNameA,tableNameB,joinClause,whereClause);
  Expression instantiatedExpression=CoreFactory.eINSTANCE.createExpression();
  instantiatedExpression.setLanguage(sqlGenericExpression.getLanguage());
  instantiatedExpression.setBody(instantiatedSQL);
  return instantiatedExpression;
}
Program: 139820
Project: 139820
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  StructuredSelection selection=(StructuredSelection)event.getSelection();
  CatalogIndicator firstElement=(CatalogIndicator)selection.getFirstElement();
  schemaTableViewer.setInput(firstElement.getSchemaIndicators());
  schemaTableViewer.getTable().setVisible(true);
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  StructuredSelection selection=(StructuredSelection)event.getSelection();
  CatalogIndicator firstElement=(CatalogIndicator)selection.getFirstElement();
  schemaTableViewer.setInput(firstElement.getSchemaIndicators());
  schemaTableViewer.getTable().setVisible(true);
  addColumnSorters(schemaTableViewer,schemaTableViewer.getTable().getColumns(),schemaSorters);
}
Program: 139821
Project: 139821
Buggy source:
public static void getIndicatorValue(TableIndicatorUnit indicatorUnit){
  Object tempObject=null;
  IndicatorEnum type=indicatorUnit.getType();
  Indicator indicator=indicatorUnit.getIndicator();
  if (indicatorUnit.isExcuted()) {
switch (type) {
case RowCountIndicatorEnum:
      tempObject=((RowCountIndicator)indicator).getCount();
    break;
case WhereRuleIndicatorEnum:
  tempObject=((WhereRuleIndicator)indicator).getUserCount();
default :
}
indicatorUnit.setValue(tempObject);
}
}

Fixed version (ground truth):
public static void getIndicatorValue(TableIndicatorUnit indicatorUnit){
  Object tempObject=null;
  IndicatorEnum type=indicatorUnit.getType();
  Indicator indicator=indicatorUnit.getIndicator();
  if (indicatorUnit.isExcuted()) {
switch (type) {
case RowCountIndicatorEnum:
      tempObject=((RowCountIndicator)indicator).getCount();
    break;
case WhereRuleIndicatorEnum:
  Long userCount=((WhereRuleIndicator)indicator).getUserCount();
tempObject=userCount == null ? 0 : userCount;
default :
}
indicatorUnit.setValue(tempObject);
}
}
Program: 139822
Project: 139822
Buggy source:
private IWorkbenchPage getActivePage(){
  if (getWorkbench() != null && getWorkbench().getActiveWorkbenchWindow() != null)   return getWorkbench().getActiveWorkbenchWindow().getActivePage();
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getActivePage".
 * @return the current actived page.
 */
public IWorkbenchPage getActivePage(){
  if (getWorkbench() != null && getWorkbench().getActiveWorkbenchWindow() != null)   return getWorkbench().getActiveWorkbenchWindow().getActivePage();
  return null;
}
Program: 139823
Project: 139823
Buggy source:
/** 
 * DOC Zqin Comment method "runInDQViewer". this method open DQ responsitory view and run the specified query.
 * @param tdDataProvider
 * @param query
 */
public void runInDQViewer(TdDataProvider tdDataProvider,String query,String editorName){
  SQLEditor sqlEditor=openInSqlEditor(tdDataProvider,query,editorName);
  if (sqlEditor != null) {
    ExecSQLAction execSQLAction=new ExecSQLAction(sqlEditor);
    execSQLAction.run();
  }
}

Fixed version (ground truth):
/** 
 * DOC Zqin Comment method "runInDQViewer". this method open DQ responsitory view and run the specified query.
 * @param tdDataProvider
 * @param query
 */
public void runInDQViewer(TdDataProvider tdDataProvider,String query,String editorName){
  SQLEditor sqlEditor=openInSqlEditor(tdDataProvider,query,editorName);
  Session session=sqlEditor.getSession();
  if (sqlEditor != null && session != null) {
    new ExecSQLAction(sqlEditor).run();
  }
}
Program: 139824
Project: 139824
Buggy source:
public IEditorPart openEditor(IFile file,String editorId){
  FileEditorInput input=new FileEditorInput(file);
  try {
    return this.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,editorId);
  }
 catch (  PartInitException e) {
    ExceptionHandler.process(e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "openEditor".
 * @param file
 * @param editorId
 * @return
 */
public IEditorPart openEditor(IFile file,String editorId){
  FileEditorInput input=new FileEditorInput(file);
  try {
    return this.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,editorId);
  }
 catch (  PartInitException e) {
    ExceptionHandler.process(e);
    return null;
  }
}
Program: 139825
Project: 139825
Buggy source:
/** 
 * DOC mzhao Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
  TdProviderConnection providerConnection=tdPc.getObject();
  String url=providerConnection.getConnectionString();
  SQLExplorerPlugin sqlexplorer=SQLExplorerPlugin.getDefault();
  Collection<Alias> aliases=sqlexplorer.getAliasManager().getAliases();
  boolean isExisted=false;
  for (  Alias alias : aliases) {
    if (alias.getUrl().equals(url)) {
      isExisted=true;
    }
  }
  if (!isExisted) {
    new ChangePerspectiveAction(PluginConstant.SE_ID).run();
  }
  SQLEditor editorPart=null;
  for (  Alias alias : aliases) {
    if (alias.getUrl().equals(url)) {
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + editorName + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      try {
        IWorkbenchPage page=SQLExplorerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
        editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
        editorPart.setText(query);
        break;
      }
 catch (      PartInitException e) {
        ExceptionHandler.process(e);
      }
    }
  }
  return editorPart;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 * @return the specified sql editor.
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(tdDataProvider.getName());
  if (alias != null) {
    try {
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + editorName + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      IWorkbenchPage page=SQLExplorerPlugin.getDefault().getActivePage();
      SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
      editorPart.setText(query);
      return editorPart;
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
  return null;
}
Program: 139827
Project: 139827
Buggy source:
@Override public void run(){
  IWorkbenchWindow aww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage ap=aww.getActivePage();
  CreateSqlFileWizard fileWizard=(CreateSqlFileWizard)WizardFactory.createSqlFileWizard(folder);
  WizardDialog dialog=new WizardDialog(Display.getDefault().getActiveShell(),fileWizard);
  fileWizard.setWindowTitle(getText());
  if (WizardDialog.OK == dialog.open()) {
    try {
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      log.error(e,e);
    }
    ChangePerspectiveAction action=new ChangePerspectiveAction(SE_ID);
    action.run();
    try {
      ap.openEditor(new SQLEditorInput(fileWizard.getSqlFile()),"String_Node_Str");
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  IWorkbenchWindow aww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage ap=aww.getActivePage();
  CreateSqlFileWizard fileWizard=(CreateSqlFileWizard)WizardFactory.createSqlFileWizard(folder);
  WizardDialog dialog=new WizardDialog(Display.getDefault().getActiveShell(),fileWizard);
  fileWizard.setWindowTitle(getText());
  if (WizardDialog.OK == dialog.open()) {
    try {
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      log.error(e,e);
    }
    try {
      ap.openEditor(new SQLEditorInput(fileWizard.getSqlFile()),"String_Node_Str");
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
}
Program: 139828
Project: 139828
Buggy source:
@Override public void run(){
  IWorkbenchWindow aww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage ap=aww.getActivePage();
  ChangePerspectiveAction action=new ChangePerspectiveAction(SE_ID);
  action.run();
  IPath location=ResourcesPlugin.getWorkspace().getRoot().getLocation();
  for (  IFile file : folder) {
    String portableString=location.append(file.getFullPath()).toPortableString();
    try {
      editorInput=new SQLEditorInput(new File(portableString));
      ap.openEditor(editorInput,"String_Node_Str");
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  IWorkbenchWindow aww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage ap=aww.getActivePage();
  IPath location=ResourcesPlugin.getWorkspace().getRoot().getLocation();
  for (  IFile file : folder) {
    String portableString=location.append(file.getFullPath()).toPortableString();
    try {
      editorInput=new SQLEditorInput(new File(portableString));
      ap.openEditor(editorInput,"String_Node_Str");
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
}
Program: 139829
Project: 139829
Buggy source:
public void deleteResource(){
  DriverManager driverManager=SQLExplorerPlugin.getDefault().getDriverModel();
  final IResource[] resources=selectedFiles;
  if (!checkDeleteContent(resources)) {
    return;
  }
  List<Map<String,String>> driverList=driverPreferCustInfo();
  for (  Map<String,String> driverInfoMap : driverList) {
    String connectionURI=driverInfoMap.get("String_Node_Str");
    for (    ModelElement tdDataProvider : modelElementList) {
      if (tdDataProvider.eResource().getURI().toString().trim().equals(connectionURI.trim())) {
        String customDriverId=driverInfoMap.get("String_Node_Str");
        if (driverManager.getDriver(customDriverId) != null) {
          driverManager.removeDriver(driverManager.getDriver(customDriverId));
        }
      }
    }
  }
  delRelatedResource(isDeleteContent,resources);
  EObjectHelper.removeDependencys(resources);
  for (  IResource res : resources) {
    try {
      res.delete(true,new NullProgressMonitor());
      res.getParent().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      log.error(e,e);
    }
  }
  DQRespositoryView findView=(DQRespositoryView)CorePlugin.getDefault().findView(DQRespositoryView.ID);
  findView.getCommonViewer().refresh();
}

Fixed version (ground truth):
public void deleteResource(){
  DriverManager driverManager=SQLExplorerPlugin.getDefault().getDriverModel();
  final IResource[] resources=selectedFiles;
  if (!checkDeleteContent(resources)) {
    return;
  }
  List<Map<String,String>> driverList=driverPreferCustInfo();
  for (  Map<String,String> driverInfoMap : driverList) {
    String connectionURI=driverInfoMap.get("String_Node_Str");
    for (    ModelElement tdDataProvider : modelElementList) {
      if (tdDataProvider.eResource().getURI().toString().trim().equals(connectionURI.trim())) {
        String customDriverId=driverInfoMap.get("String_Node_Str");
        if (driverManager.getDriver(customDriverId) != null) {
          driverManager.removeDriver(driverManager.getDriver(customDriverId));
        }
      }
    }
  }
  delRelatedResource(isDeleteContent,resources);
  EObjectHelper.removeDependencys(resources);
  for (  IResource res : resources) {
    try {
      res.delete(true,new NullProgressMonitor());
      res.getParent().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      log.error(e,e);
    }
  }
  CorePlugin.getDefault().refreshDQView();
}
Program: 139831
Project: 139831
Buggy source:
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      IPath path=new Path(ResourceManager.LIBRARIES_FOLDER_NAME);
      path=path.append(DQStructureManager.SOURCE_FILES);
      IPath fullPath=((IFolder)obj).getFullPath();
      if (path.isPrefixOf(fullPath)) {
        menu.add(new AddSqlFileAction((IFolder)obj));
        if (fullPath.segmentCount() > path.segmentCount()) {
          menu.add(new RenameFolderAction((IFolder)obj));
        }
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if (file.getFileExtension().equalsIgnoreCase("String_Node_Str")) {
        menu.add(new RenameSqlFileAction((IFile)obj));
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new OpenSqlFileAction(selectedFiles));
    menu.add(new DeleteSqlFileAction(selectedFiles));
  }
}

Fixed version (ground truth):
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      IPath fullPath=((IFolder)obj).getFullPath();
      IPath sourceFileFolderPath=ResourceManager.getLibrariesFolder().getFolder(DQStructureManager.SOURCE_FILES).getFullPath();
      if (fullPath.equals(sourceFileFolderPath)) {
        menu.add(new AddSqlFileAction((IFolder)obj));
        if (fullPath.segmentCount() > sourceFileFolderPath.segmentCount()) {
          menu.add(new RenameFolderAction((IFolder)obj));
        }
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if (file.getFileExtension().equalsIgnoreCase("String_Node_Str")) {
        menu.add(new RenameSqlFileAction((IFile)obj));
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new OpenSqlFileAction(selectedFiles));
    menu.add(new DeleteSqlFileAction(selectedFiles));
  }
}
Program: 139834
Project: 139834
Buggy source:
/** 
 * DOC bZhou Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 * @return the specified sql editor.
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(tdDataProvider.getName());
  if (alias != null) {
    try {
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + editorName + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      IWorkbenchPage page=SQLExplorerPlugin.getDefault().getActivePage();
      SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
      editorPart.setText(query);
      return editorPart;
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 * @return the specified sql editor.
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(tdDataProvider.getName());
  if (alias == null) {
    List<TdDataProvider> allDataProviders=PrvResourceFileHelper.getInstance().getAllDataProviders(ResourceManager.getMetadataFolder());
    for (    TdDataProvider dataProvider : allDataProviders) {
      if (dataProvider == tdDataProvider) {
        addConnetionAliasToSQLPlugin(dataProvider);
        openInSqlEditor(tdDataProvider,query,editorName);
      }
    }
  }
 else {
    try {
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + editorName + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      IWorkbenchPage page=SQLExplorerPlugin.getDefault().getActivePage();
      SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
      editorPart.setText(query);
      return editorPart;
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
  return null;
}
Program: 139835
Project: 139835
Buggy source:
@Override public boolean storeSqlResults(List<Object[]> objects){
  if (!checkResults(objects,2)) {
    return false;
  }
  Object c=objects.get(0)[0];
  this.setMode(c);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + c);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean storeSqlResults(List<Object[]> objects){
  if (objects != null && objects.isEmpty()) {
    this.setMode("String_Node_Str");
    return true;
  }
  if (!checkResults(objects,2)) {
    return false;
  }
  Object c=objects.get(0)[0];
  this.setMode(c);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + c);
  }
  return true;
}
Program: 139836
Project: 139836
Buggy source:
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 1) {
        if (selection[0] instanceof IFolder) {
          IFolder folder=(IFolder)selection[0];
          IPath projectRelativePath=folder.getProjectRelativePath();
          if ("String_Node_Str".equals(folder.getProject().getName())) {
            IPath path=new Path("String_Node_Str");
            if (path.isPrefixOf(projectRelativePath)) {
              return Status.OK_STATUS;
            }
          }
        }
      }
      return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  IProject rootProject=SQLExplorerPlugin.getDefault().getRootProject();
  final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 1) {
        if (selection[0] instanceof IFolder) {
          IFolder folder=(IFolder)selection[0];
          IPath projectRelativePath=folder.getProjectRelativePath();
          if ("String_Node_Str".equals(folder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(folder.getFullPath())) {
            return Status.OK_STATUS;
          }
        }
      }
      return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
);
}
Program: 139837
Project: 139837
Buggy source:
public IStatus validate(Object[] selection){
  if (selection.length == 1) {
    if (selection[0] instanceof IFolder) {
      IFolder folder=(IFolder)selection[0];
      IPath projectRelativePath=folder.getProjectRelativePath();
      if ("String_Node_Str".equals(folder.getProject().getName())) {
        IPath path=new Path("String_Node_Str");
        if (path.isPrefixOf(projectRelativePath)) {
          return Status.OK_STATUS;
        }
      }
    }
  }
  return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
}

Fixed version (ground truth):
public IStatus validate(Object[] selection){
  if (selection.length == 1) {
    if (selection[0] instanceof IFolder) {
      IFolder folder=(IFolder)selection[0];
      IPath projectRelativePath=folder.getProjectRelativePath();
      if ("String_Node_Str".equals(folder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(folder.getFullPath())) {
        return Status.OK_STATUS;
      }
    }
  }
  return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
}
Program: 139838
Project: 139838
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (IProject.class.isInstance(element)) {
    return "String_Node_Str".equals(((IProject)element).getName());
  }
 else   if (IFolder.class.isInstance(element)) {
    IPath path=new Path("String_Node_Str");
    IPath projectRelativePath=((IFolder)element).getProjectRelativePath();
    return path.isPrefixOf(projectRelativePath);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    if ("String_Node_Str".equals(folder.getName()) || "String_Node_Str".equals(folder.getName())) {
      return true;
    }
 else {
      return defaultValidFolder.getFullPath().isPrefixOf(folder.getFullPath());
    }
  }
  return false;
}
Program: 139840
Project: 139840
Buggy source:
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  org.talend.dataquality.PluginConstant.setRootProjectName(ResourceManager.getRootProjectName());
  SQLExplorerPlugin.getDefault().setRootProject(ResourceManager.getRootProject());
}
Program: 139841
Project: 139841
Buggy source:
public static IProject getRootProject(){
  IProject rootProject=null;
  try {
    IProjectAdapterService projectAdapter=(IProjectAdapterService)GlobalServiceRegister.getDefault().getService(IProjectAdapterService.class);
    if (projectAdapter != null) {
      rootProject=projectAdapter.getRootProject();
    }
  }
 catch (  RuntimeException e) {
    Log.warn(e,e);
    rootProject=ResourcesPlugin.getWorkspace().getRoot().getProject(DEFAULT_PROJECT_NAME);
  }
  PluginConstant.setRootProjectName(rootProject.getName());
  return rootProject;
}

Fixed version (ground truth):
public static IProject getRootProject(){
  IProject rootProject=null;
  try {
    IProjectAdapterService projectAdapter=(IProjectAdapterService)GlobalServiceRegister.getDefault().getService(IProjectAdapterService.class);
    if (projectAdapter != null) {
      rootProject=projectAdapter.getRootProject();
    }
  }
 catch (  RuntimeException e) {
    rootProject=ResourcesPlugin.getWorkspace().getRoot().getProject(DEFAULT_PROJECT_NAME);
  }
  return rootProject;
}
Program: 139842
Project: 139842
Buggy source:
private String getAlias(String colName,DateGrain dateAggregationType){
  if (dbms().supportAliasesInGroupBy()) {
    return "String_Node_Str" + unquote(colName) + dateAggregationType.getName()+ "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
private String getAlias(String colName,DateGrain dateAggregationType){
  if (dbms().supportAliasesInGroupBy()) {
    return "String_Node_Str" + dateAggregationType.getName() + "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}
Program: 139843
Project: 139843
Buggy source:
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  org.talend.dataquality.PluginConstant.setRootProjectName(ResourceManager.getRootProjectName());
  SQLExplorerPlugin.getDefault().setRootProject(ResourceManager.getRootProject());
}

Fixed version (ground truth):
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  IProject rootProject=ResourceManager.getRootProject();
  org.talend.dataquality.PluginConstant.setRootProjectName(rootProject.getName());
  SQLExplorerPlugin.getDefault().setRootProject(rootProject);
}
Program: 139844
Project: 139844
Buggy source:
/** 
 * DOC xqliu Comment method "getColumns". ADD xqliu 2009-04-27 bug 6507
 * @param columnSet
 * @param filter
 * @return
 */
public static List<TdColumn> getColumns(ColumnSet columnSet,boolean filter){
  if (filter) {
    return ColumnHelper.getColumnsWithFilter(columnSet,filter);
  }
 else {
    return getColumns(columnSet);
  }
}

Fixed version (ground truth):
public static List<TdColumn> getColumns(ColumnSet columnSet){
  return ColumnHelper.getColumns(columnSet.getFeature());
}
Program: 139845
Project: 139845
Buggy source:
/** 
 * Method "getColumnSets" returns tables or views. MOD xqliu 2009-04-27 bug 6507
 * @param catalogName a catalog name; must match the catalog name as it is stored in the database; "" retrievesthose without a catalog; null means that the catalog name should not be used to narrow the search
 * @param schemaPattern a schema name pattern; must match the schema name as it is stored in the database; ""retrieves those without a schema; null means that the schema name should not be used to narrow the search
 * @param tablePattern table name patterns separated by a comma; must match the table name as it is stored in thedatabase
 * @return the tables with for the given catalog, schemas, table name pattern.
 * @throws SQLException
 */
public List<T> getColumnSets(String catalogName,String schemaPattern,String tablePattern) throws SQLException {
  if (debug)   incrementCount(catalogName,schemaPattern);
  List<T> tables=new ArrayList<T>();
  if (tablePattern == null) {
    addMatchingColumnSets(catalogName,schemaPattern,tablePattern,tables);
  }
 else {
    String[] patterns=cleanPatterns(tablePattern.split("String_Node_Str"));
    for (    String pattern : patterns) {
      addMatchingColumnSets(catalogName,schemaPattern,pattern,tables);
    }
  }
  return tables;
}

Fixed version (ground truth):
/** 
 * Method "getColumnSets" returns tables or views. MOD xqliu 2009-04-27 bug 6507
 * @param catalogName a catalog name; must match the catalog name as it is stored in the database; "" retrievesthose without a catalog; null means that the catalog name should not be used to narrow the search
 * @param schemaPattern a schema name pattern; must match the schema name as it is stored in the database; ""retrieves those without a schema; null means that the schema name should not be used to narrow the search
 * @param tablePattern table name patterns separated by a comma; must match the table name as it is stored in thedatabase
 * @return the tables with for the given catalog, schemas, table name pattern.
 * @throws SQLException
 */
public List<T> getColumnSets(String catalogName,String schemaPattern,String tablePattern) throws SQLException {
  List<T> tables=new ArrayList<T>();
  ResultSet tablesSet=getConnectionMetadata(connection).getTables(catalogName,schemaPattern,tablePattern,this.tableType);
  while (tablesSet.next()) {
    T table=createTable(catalogName,schemaPattern,tablesSet);
    tables.add(table);
  }
  tablesSet.close();
  return tables;
}
Program: 139847
Project: 139847
Buggy source:
/** 
 * DOC xqliu Comment method "initPreferences".
 * @param cwm
 */
private void initPreferences(CWMPlugin cwm){
  Preferences prefs=cwm.getPluginPreferences();
  prefs.setDefault(PluginConstant.CONNECTION_TIMEOUT,false);
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "initPreferences".
 * @param cwm
 */
private void initPreferences(CWMPlugin cwm){
  Preferences prefs=cwm.getPluginPreferences();
  prefs.setDefault(PluginConstant.CONNECTION_TIMEOUT,false);
  prefs.setDefault(PluginConstant.FILTER_TABLE_VIEW_COLUMN,true);
}
Program: 139849
Project: 139849
Buggy source:
@Override protected List<TdTable> getColumnSets(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String tableFilter=TaggedValueHelper.getValue(TaggedValueHelper.TABLE_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getTables(catalog),tableFilter);
  }
  if (schema != null) {
    String tableFilter=TaggedValueHelper.getValue(TaggedValueHelper.TABLE_FILTER,schema.getTaggedValue());
    return filterColumnSets(SchemaHelper.getTables(schema),tableFilter);
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override protected List<TdTable> getColumnSets(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    return CatalogHelper.getTables(catalog);
  }
  if (schema != null) {
    return SchemaHelper.getTables(schema);
  }
  return Collections.emptyList();
}
Program: 139850
Project: 139850
Buggy source:
@Override protected List<TdView> getColumnSets(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,catalog.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  if (schema != null) {
    String viewFilter=TaggedValueHelper.getValue(TaggedValueHelper.VIEW_FILTER,schema.getTaggedValue());
    return filterColumnSets(CatalogHelper.getViews(catalog),viewFilter);
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override protected List<TdView> getColumnSets(TdCatalog catalog,TdSchema schema){
  if (catalog != null) {
    return CatalogHelper.getViews(catalog);
  }
  if (schema != null) {
    return SchemaHelper.getViews(schema);
  }
  return Collections.emptyList();
}
Program: 139851
Project: 139851
Buggy source:
public void run(IIntroSite site,Properties params){
  String property=params.getProperty("String_Node_Str");
  OpenCheatSheetAction action=new OpenCheatSheetAction(property);
  action.run();
  IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart findView=activePage.findView(IIntroConstants.INTRO_VIEW_ID);
  if (findView != null) {
    activePage.hideView(findView);
  }
}

Fixed version (ground truth):
public void run(IIntroSite site,Properties params){
  IPerspectiveDescriptor persDescription1=PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(PERSPECTIVE_ID);
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(persDescription1);
  String property=params.getProperty("String_Node_Str");
  OpenCheatSheetAction action=new OpenCheatSheetAction(property);
  action.run();
  IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart findView=activePage.findView(IIntroConstants.INTRO_VIEW_ID);
  if (findView != null) {
    activePage.hideView(findView);
  }
}
Program: 139852
Project: 139852
Buggy source:
public AbstractMigrationTask(String id,String name){
  this.id=id;
  this.name=name;
}

Fixed version (ground truth):
public AbstractMigrationTask(String id,String name,String version){
  this.id=id;
  this.name=name;
  this.version=version;
}
Program: 139853
Project: 139853
Buggy source:
public static List<IWorkspaceMigrationTask> findValidMigrationTasks(){
  List<IWorkspaceMigrationTask> validTasks=new ArrayList<IWorkspaceMigrationTask>();
  IConfigurationElement[] elems=Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
  ProductVersion workspaceVersion=WorkspaceVersionHelper.getVesion();
  ProductVersion currentVersion=CorePlugin.getDefault().getProductVersion();
  for (  IConfigurationElement elem : elems) {
    String attribute=elem.getAttribute(ATTR_VERSION);
    ProductVersion taskVersion=ProductVersion.fromString(attribute);
    if (taskVersion.compareTo(workspaceVersion) > 0 && taskVersion.compareTo(currentVersion) <= 0) {
      try {
        validTasks.add((IWorkspaceMigrationTask)elem.createExecutableExtension(ATTR_CLASS));
      }
 catch (      CoreException e) {
        log.error(e,e);
      }
    }
  }
  sortTasks(validTasks);
  return validTasks;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "findValidMigrationTasks".
 * @return
 */
public static List<IWorkspaceMigrationTask> findValidMigrationTasks(){
  List<IWorkspaceMigrationTask> validTasks=new ArrayList<IWorkspaceMigrationTask>();
  ProductVersion workspaceVersion=WorkspaceVersionHelper.getVesion();
  ProductVersion currentVersion=CorePlugin.getDefault().getProductVersion();
  List<IWorkspaceMigrationTask> allTasks=findAllMigrationTasks();
  for (  IWorkspaceMigrationTask task : allTasks) {
    ProductVersion taskVersion=ProductVersion.fromString(task.getVersion());
    if (taskVersion.compareTo(workspaceVersion) > 0 && taskVersion.compareTo(currentVersion) <= 0) {
      validTasks.add(task);
    }
  }
  return validTasks;
}
Program: 139854
Project: 139854
Buggy source:
public static List<IWorkspaceMigrationTask> findAllMigrationTasks(){
  List<IWorkspaceMigrationTask> allTasks=new ArrayList<IWorkspaceMigrationTask>();
  IConfigurationElement[] elems=Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
  for (  IConfigurationElement elem : elems) {
    try {
      allTasks.add((IWorkspaceMigrationTask)elem.createExecutableExtension(ATTR_CLASS));
    }
 catch (    CoreException e) {
      log.error(e,e);
    }
  }
  sortTasks(allTasks);
  return allTasks;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "findAllMigrationTasks".
 * @return
 */
public static List<IWorkspaceMigrationTask> findAllMigrationTasks(){
  List<IWorkspaceMigrationTask> allTasks=new ArrayList<IWorkspaceMigrationTask>();
  IConfigurationElement[] elems=Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
  for (  IConfigurationElement elem : elems) {
    try {
      String taskName=elem.getAttribute(ATTR_NAME);
      String taskID=elem.getAttribute(ATTR_PID);
      String version=elem.getAttribute(ATTR_VERSION);
      IWorkspaceMigrationTask migrationTask=(IWorkspaceMigrationTask)elem.createExecutableExtension(ATTR_CLASS);
      migrationTask.setName(taskName);
      migrationTask.setId(taskID);
      migrationTask.setVersion(version);
      allTasks.add(migrationTask);
    }
 catch (    CoreException e) {
      e.printStackTrace();
      log.error(e,e);
    }
  }
  sortTasks(allTasks);
  return allTasks;
}
Program: 139855
Project: 139855
Buggy source:
private static void sortTasks(List<IWorkspaceMigrationTask> tasks){
  Collections.sort(tasks,new Comparator<IWorkspaceMigrationTask>(){
    public int compare(    IWorkspaceMigrationTask o1,    IWorkspaceMigrationTask o2){
      if (o1.getOrder() == null || o2.getOrder() == null) {
        return 0;
      }
      return o1.getOrder().compareTo(o2.getOrder());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "sortTasks".
 * @param tasks
 */
private static void sortTasks(List<IWorkspaceMigrationTask> tasks){
  Collections.sort(tasks,new Comparator<IWorkspaceMigrationTask>(){
    public int compare(    IWorkspaceMigrationTask o1,    IWorkspaceMigrationTask o2){
      if (o1.getOrder() == null || o2.getOrder() == null) {
        return 0;
      }
      return o1.getOrder().compareTo(o2.getOrder());
    }
  }
);
}
Program: 139857
Project: 139857
Buggy source:
/** 
 * DOC mzhao get file by name at the same location.
 * @param fileName
 * @return IFile
 */
private static IFile getFile(String fileName){
  IFolder folder=ResourcesPlugin.getWorkspace().getRoot().getProject(org.talend.dataquality.PluginConstant.getRootProjectName()).getFolder(DQStructureManager.getMetaData()).getFolder(DQStructureManager.DB_CONNECTIONS);
  IFile file=folder.getFile(fileName);
  return file;
}

Fixed version (ground truth):
/** 
 * DOC mzhao get file by name at the same location.
 * @param fileName
 * @return IFile
 */
private static IFile getFile(String fileName){
  IFolder folder=ResourceManager.getMetadataFolder().getFolder(DQStructureManager.DB_CONNECTIONS);
  IFile file=folder.getFile(fileName);
  return file;
}
Program: 139858
Project: 139858
Buggy source:
public void doMigrationTask(){
  List<IWorkspaceMigrationTask> tasks=MigrationTaskManager.findValidMigrationTasks();
  if (!tasks.isEmpty()) {
    for (    IWorkspaceMigrationTask task : tasks) {
      if (!(task instanceof TDCPFolderMergeTask)) {
        task.execute();
      }
    }
    WorkspaceVersionHelper.storeVersion();
  }
}

Fixed version (ground truth):
public void doMigrationTask(){
  List<IWorkspaceMigrationTask> tasks=MigrationTaskManager.findValidMigrationTasks();
  if (!tasks.isEmpty()) {
    for (    IWorkspaceMigrationTask task : tasks) {
      if (!(task instanceof TDCPFolderMergeTask)) {
        log.warn("String_Node_Str" + task.getClass().getName());
        task.execute();
      }
    }
    WorkspaceVersionHelper.storeVersion();
  }
}
Program: 139859
Project: 139859
Buggy source:
public void checkDQStructure(){
  if (!getDefault().isUsed(org.talend.dataquality.PluginConstant.getRootProjectName())) {
    DQStructureManager manager=DQStructureManager.getInstance();
    getDefault().setUsed(manager.createDQStructure(),org.talend.dataquality.PluginConstant.getRootProjectName());
  }
}

Fixed version (ground truth):
public void checkDQStructure(){
  if (isNeedCreateStructure()) {
    DQStructureManager manager=DQStructureManager.getInstance();
    if (!manager.createDQStructure()) {
      log.error("String_Node_Str");
    }
  }
}