nus-yam/ex-repair huggingface dataset:
Program: 137011
Project: 137011
Buggy source:
public void removeAliasInSQLExplorer(DataProvider... dataproviders){
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  DatabaseStructureView dsView=sqlPlugin.getDatabaseStructureView();
  try {
    Collection<Alias> aliases=aliasManager.getAliases();
    if (aliases.isEmpty()) {
      return;
    }
    for (    DataProvider dataProvider : dataproviders) {
      String aliasName=dataProvider.getName();
      if (null == aliasName) {
        continue;
      }
      Alias alias=aliasManager.getAlias(aliasName);
      if (alias != null) {
        sqlPlugin.getPropertyFile().remove(alias);
        aliasManager.removeAlias(aliasName);
      }
      if (dsView != null) {
        dsView.closeCurrentCabItem(aliasName);
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  aliasManager.modelChanged();
}

Fixed version (ground truth):
@Override public void removeAliasInSQLExplorer(DataProvider... dataproviders){
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  DatabaseStructureView dsView=sqlPlugin.getDatabaseStructureView();
  try {
    Collection<Alias> aliases=aliasManager.getAliases();
    if (aliases.isEmpty()) {
      return;
    }
    for (    DataProvider dataProvider : dataproviders) {
      String aliasName=dataProvider.getName();
      if (null == aliasName) {
        continue;
      }
      Alias alias=aliasManager.getAlias(aliasName);
      if (alias != null) {
        sqlPlugin.getPropertyFile().remove(alias);
        aliasManager.removeAlias(aliasName);
      }
      if (dsView != null) {
        dsView.closeCurrentCabItem(aliasName);
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  aliasManager.modelChanged();
}
Program: 137012
Project: 137012
Buggy source:
public Driver getClassDriverFromSQLExplorer(String driverClassName,Properties props) throws InstantiationException, IllegalAccessException {
  Driver driver=null;
  if (Platform.isRunning()) {
    SQLExplorerPlugin sqlExplorerPlugin=SQLExplorerPlugin.getDefault();
    if (sqlExplorerPlugin != null) {
      DriverManager driverModel=sqlExplorerPlugin.getDriverModel();
      String dbType=props.getProperty(TaggedValueHelper.DBTYPE);
      String dbVersion=props.getProperty(TaggedValueHelper.DB_PRODUCT_VERSION);
      String managedDriverId=AliasAndManaDriverHelper.getInstance().joinManagedDriverId(dbType,driverClassName,dbVersion);
      ManagedDriver managedDriver=driverModel.getDriver(managedDriverId);
      if (managedDriver != null) {
        if (!managedDriver.isDriverClassLoaded()) {
          loadDriverByLibManageSystem(dbType,dbVersion,driverClassName);
        }
        driver=managedDriver.getJdbcDriver();
      }
    }
  }
  return driver;
}

Fixed version (ground truth):
@Override public Driver getClassDriverFromSQLExplorer(String driverClassName,Properties props) throws InstantiationException, IllegalAccessException {
  Driver driver=null;
  if (Platform.isRunning()) {
    SQLExplorerPlugin sqlExplorerPlugin=SQLExplorerPlugin.getDefault();
    if (sqlExplorerPlugin != null) {
      DriverManager driverModel=sqlExplorerPlugin.getDriverModel();
      String dbType=props.getProperty(TaggedValueHelper.DBTYPE);
      String dbVersion=props.getProperty(TaggedValueHelper.DB_PRODUCT_VERSION);
      String managedDriverId=AliasAndManaDriverHelper.getInstance().joinManagedDriverId(dbType,driverClassName,dbVersion);
      ManagedDriver managedDriver=driverModel.getDriver(managedDriverId);
      if (managedDriver != null) {
        if (!managedDriver.isDriverClassLoaded()) {
          loadDriverByLibManageSystem(dbType,dbVersion,driverClassName);
        }
        driver=managedDriver.getJdbcDriver();
      }
    }
  }
  return driver;
}
Program: 137013
Project: 137013
Buggy source:
public Object createMapDBDataSet(String[] columnHeader,Object mapDB,int pageSize,Object columnFilter,Long itemSize){
  return new MapDBDataSet(columnHeader,(Map<Object,List<Object>>)mapDB,pageSize,(ColumnFilter)columnFilter,itemSize);
}

Fixed version (ground truth):
@Override public Object createMapDBDataSet(String[] columnHeader,Object mapDB,int pageSize,Object columnFilter,Long itemSize){
  return new MapDBDataSet(columnHeader,(Map<Object,List<Object>>)mapDB,pageSize,(ColumnFilter)columnFilter,itemSize);
}
Program: 137014
Project: 137014
Buggy source:
public Class[] getMyURLClassLoaderAssignableClasses(URL url){
  Class[] classes=null;
  try {
    classes=new MyURLClassLoader(url).getAssignableClasses(Driver.class);
  }
 catch (  Exception e) {
    classes=new Class[]{};
  }
  return classes;
}

Fixed version (ground truth):
@Override public Class[] getMyURLClassLoaderAssignableClasses(URL url){
  Class[] classes=null;
  try {
    classes=new MyURLClassLoader(url).getAssignableClasses(Driver.class);
  }
 catch (  Exception e) {
    classes=new Class[]{};
  }
  return classes;
}
Program: 137015
Project: 137015
Buggy source:
public void updateConnetionAliasByName(Connection connection,String aliasName){
  if (connection == null || aliasName == null) {
    return;
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  IWorkbenchPage page=sqlPlugin.getActivePage();
  if (page != null) {
    DatabaseStructureView view=(DatabaseStructureView)page.findView(DatabaseStructureView.class.getName());
    if (view != null) {
      view.closeCurrentCabItem(aliasName);
    }
  }
 else {
    log.error("String_Node_Str");
  }
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(aliasName);
  if (alias != null) {
    try {
      aliasManager.removeAlias(aliasName);
      addConnetionAliasToSQLPlugin(connection);
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
}

Fixed version (ground truth):
@Override public void updateConnetionAliasByName(Connection connection,String aliasName){
  if (connection == null || aliasName == null) {
    return;
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  IWorkbenchPage page=sqlPlugin.getActivePage();
  if (page != null) {
    DatabaseStructureView view=(DatabaseStructureView)page.findView(DatabaseStructureView.class.getName());
    if (view != null) {
      view.closeCurrentCabItem(aliasName);
    }
  }
 else {
    log.error("String_Node_Str");
  }
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(aliasName);
  if (alias != null) {
    try {
      aliasManager.removeAlias(aliasName);
      addConnetionAliasToSQLPlugin(connection);
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
}
Program: 137016
Project: 137016
Buggy source:
public boolean needAddDriverConnection(DatabaseConnection dbConn){
  boolean isNeed=false;
  DriverManager driverManager=SQLExplorerPlugin.getDefault().getDriverModel();
  String id=AliasAndManaDriverHelper.getInstance().joinManagedDriverId(dbConn);
  ManagedDriver manDr=driverManager.getDriver(id);
  if (manDr == null) {
    isNeed=true;
  }
 else   if (!manDr.isDriverClassLoaded()) {
    loadDriverByLibManageSystem(dbConn);
    if (!manDr.isDriverClassLoaded()) {
      isNeed=true;
    }
  }
  return isNeed;
}

Fixed version (ground truth):
@Override public boolean needAddDriverConnection(DatabaseConnection dbConn){
  boolean isNeed=false;
  DriverManager driverManager=SQLExplorerPlugin.getDefault().getDriverModel();
  String id=AliasAndManaDriverHelper.getInstance().joinManagedDriverId(dbConn);
  ManagedDriver manDr=driverManager.getDriver(id);
  if (manDr == null) {
    isNeed=true;
  }
 else   if (!manDr.isDriverClassLoaded()) {
    loadDriverByLibManageSystem(dbConn);
    if (!manDr.isDriverClassLoaded()) {
      isNeed=true;
    }
  }
  return isNeed;
}
Program: 137017
Project: 137017
Buggy source:
public Object createMapDBSetDataSet(String[] columnHeader,Object mapDB,int pageSize){
  return new MapDBSetDataSet(columnHeader,(Set<Object>)mapDB,pageSize);
}

Fixed version (ground truth):
@Override public Object createMapDBSetDataSet(String[] columnHeader,Object mapDB,int pageSize){
  return new MapDBSetDataSet(columnHeader,(Set<Object>)mapDB,pageSize);
}
Program: 137019
Project: 137019
Buggy source:
public void setSqlEditorEditable(Object part,boolean lock){
  if (part instanceof SQLEditor) {
    ((SQLEditor)part).setEditable(lock);
  }
}

Fixed version (ground truth):
@Override public void setSqlEditorEditable(Object part,boolean lock){
  if (part instanceof SQLEditor) {
    ((SQLEditor)part).setEditable(lock);
  }
}
Program: 137020
Project: 137020
Buggy source:
public void setExportCSVActionTable(Object action,Object table){
  if (action instanceof ExportCSVAction && table instanceof Table) {
    ExportCSVAction exportAction=(ExportCSVAction)action;
    exportAction.setEnabled(true);
    exportAction.setTable((Table)table);
  }
}

Fixed version (ground truth):
@Override public void setExportCSVActionTable(Object action,Object table){
  if (action instanceof ExportCSVAction && table instanceof Table) {
    ExportCSVAction exportAction=(ExportCSVAction)action;
    exportAction.setEnabled(true);
    exportAction.setTable((Table)table);
  }
}
Program: 137021
Project: 137021
Buggy source:
public void resetTalendDataSetIndex(Object talendDataSet,long fromIndex,long toIndex){
  TalendDataSet tds=(TalendDataSet)talendDataSet;
  tds.setStartIndex(fromIndex);
  tds.setEndIndex(toIndex);
}

Fixed version (ground truth):
@Override public void resetTalendDataSetIndex(Object talendDataSet,long fromIndex,long toIndex){
  TalendDataSet tds=(TalendDataSet)talendDataSet;
  tds.setStartIndex(fromIndex);
  tds.setEndIndex(toIndex);
}
Program: 137023
Project: 137023
Buggy source:
public void selectionChanged(IAction action,ISelection selection){
  if (selection != null && selection instanceof TreeSelection) {
    TreeSelection ts=(TreeSelection)selection;
    TreePath[] treepaths=ts.getPaths();
    if (treepaths.length >= 1) {
      int count=treepaths[0].getSegmentCount();
      for (int i=0; i < count; i++) {
        Object o=treepaths[0].getSegment(i);
        if (o instanceof IFile) {
          if (((IFile)o).getFileExtension().toLowerCase().equals("String_Node_Str")) {
            selectedFileObject=(IFile)o;
          }
        }
 else         if (o instanceof Schema) {
          selectedSchema=(Schema)o;
        }
 else         if (o instanceof Catalog) {
          selectedCatalog=(Catalog)o;
        }
 else         if (o instanceof Connection) {
          selectedDataProvider=(Connection)o;
        }
      }
    }
    selectedObject=ts.getFirstElement();
  }
}

Fixed version (ground truth):
@Override public void selectionChanged(IAction action,ISelection selection){
  if (selection != null && selection instanceof TreeSelection) {
    TreeSelection ts=(TreeSelection)selection;
    TreePath[] treepaths=ts.getPaths();
    if (treepaths.length >= 1) {
      int count=treepaths[0].getSegmentCount();
      for (int i=0; i < count; i++) {
        Object o=treepaths[0].getSegment(i);
        if (o instanceof IFile) {
          if (((IFile)o).getFileExtension().toLowerCase().equals("String_Node_Str")) {
            selectedFileObject=(IFile)o;
          }
        }
 else         if (o instanceof Schema) {
          selectedSchema=(Schema)o;
        }
 else         if (o instanceof Catalog) {
          selectedCatalog=(Catalog)o;
        }
 else         if (o instanceof Connection) {
          selectedDataProvider=(Connection)o;
        }
      }
    }
    selectedObject=ts.getFirstElement();
  }
}
Program: 137024
Project: 137024
Buggy source:
public void run(IAction action){
  synchronize();
}

Fixed version (ground truth):
@Override public void run(IAction action){
  synchronize();
}
Program: 137025
Project: 137025
Buggy source:
public void setActivePart(IAction action,IWorkbenchPart targetPart){
  this.workbenchpart=targetPart;
}

Fixed version (ground truth):
@Override public void setActivePart(IAction action,IWorkbenchPart targetPart){
  this.workbenchpart=targetPart;
}
Program: 137028
Project: 137028
Buggy source:
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @deprecated Is Replaced By DBConnectionFiller.fillUIConnParams
 * @param dbConn
 * @return
 */
@Deprecated public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.createConnection(metaConnection).getObject();
      if (sqlConn != null) {
        DatabaseMetaData dm=ExtractMetaDataUtils.getInstance().getDatabaseMetaData(sqlConn,dbConn,false);
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,dm,MetadataConnectionUtils.getPackageFilter(dbConn,dm,true));
        MetadataFillFactory.getDBInstance().fillSchemas(dbConn,dm,MetadataConnectionUtils.getPackageFilter(dbConn,dm,false));
      }
    }
  }
  finally {
    if (sqlConn != null) {
      ConnectionUtils.closeConnection(sqlConn);
    }
  }
  return dbConn;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @deprecated Is Replaced By DBConnectionFiller.fillUIConnParams
 * @param dbConn
 * @return
 */
@Deprecated public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      MetadataFillFactory dbInstance=MetadataFillFactory.getDBInstance(dbConn);
      dbConn=(DatabaseConnection)dbInstance.fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.createConnection(metaConnection).getObject();
      if (sqlConn != null) {
        DatabaseMetaData dm=ExtractMetaDataUtils.getInstance().getDatabaseMetaData(sqlConn,dbConn,false);
        dbInstance.fillCatalogs(dbConn,dm,MetadataConnectionUtils.getPackageFilter(dbConn,dm,true));
        dbInstance.fillSchemas(dbConn,dm,MetadataConnectionUtils.getPackageFilter(dbConn,dm,false));
      }
    }
  }
  finally {
    if (sqlConn != null) {
      ConnectionUtils.closeConnection(sqlConn);
    }
  }
  return dbConn;
}
Program: 137029
Project: 137029
Buggy source:
/** 
 * Updata DB_PRODUCT tagged values for connection item in case they are not present in current file.
 * @throws SQLException
 */
public static synchronized void updataTaggedValueForConnectionItem(Connection dataProvider){
  if (dataProvider instanceof DatabaseConnection && StringUtils.isBlank(TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_NAME,dataProvider))) {
    Property property=PropertyHelper.getProperty(dataProvider);
    if (property != null) {
      Item item=property.getItem();
      if (item != null) {
        DatabaseConnection dbConn=(DatabaseConnection)dataProvider;
        IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
        dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
        if (dbConn != null && Platform.isRunning()) {
          try {
            ProxyRepositoryFactory.getInstance().save(item);
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updata DB_PRODUCT tagged values for connection item in case they are not present in current file.
 * @throws SQLException
 */
public static synchronized void updataTaggedValueForConnectionItem(Connection dataProvider){
  if (dataProvider instanceof DatabaseConnection && StringUtils.isBlank(TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_NAME,dataProvider))) {
    Property property=PropertyHelper.getProperty(dataProvider);
    if (property != null) {
      Item item=property.getItem();
      if (item != null) {
        DatabaseConnection dbConn=(DatabaseConnection)dataProvider;
        IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
        dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance(dataProvider).fillUIConnParams(metaConnection,dbConn);
        if (dbConn != null && Platform.isRunning()) {
          try {
            ProxyRepositoryFactory.getInstance().save(item);
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
        }
      }
    }
  }
}
Program: 137030
Project: 137030
Buggy source:
/** 
 * DOC yyin Comment method "addResultToIndicatorToRowMap".
 * @param indicator
 * @param indicToRowMap
 */
private void addResultToIndicatorToRowMap(Indicator indicator,EMap<Indicator,AnalyzedDataSet> indicToRowMap){
  Map<Object,List<Object[]>> dupMap=((DuplicateCountIndicator)indicator).getDuplicateMap();
  Iterator<Object> iterator=dupMap.keySet().iterator();
  int maxNumberRows=analysis.getParameters().getMaxNumberRows();
  while (iterator.hasNext()) {
    Object key=iterator.next();
    List<Object[]> valuelist=dupMap.get(key);
    if (valuelist.size() > 1) {
      List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,key);
      int recordIncrement=valueObjectList.size();
      for (      Object[] row : valuelist) {
        if (recordIncrement < maxNumberRows) {
          valueObjectList.add(row);
        }
 else {
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC yyin Comment method "addResultToIndicatorToRowMap".
 * @param indicator
 * @param indicToRowMap
 */
private void addResultToIndicatorToRowMap(Indicator indicator,EMap<Indicator,AnalyzedDataSet> indicToRowMap){
  Map<Object,Object[]> dupMap=((DuplicateCountIndicator)indicator).getDuplicateMap();
  Set<Object> duplicateValues=((DuplicateCountIndicator)indicator).getDuplicateValues();
  Iterator<Object> iterator=duplicateValues.iterator();
  int maxNumberRows=analysis.getParameters().getMaxNumberRows();
  while (iterator.hasNext()) {
    Object key=iterator.next();
    Object[] valueArray=dupMap.get(key);
    if (valueArray == null) {
      continue;
    }
    List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,key);
    int NumberOfRecord=valueObjectList.size();
    if (NumberOfRecord < maxNumberRows) {
      valueObjectList.add(valueArray);
    }
 else {
      break;
    }
  }
}
Program: 137031
Project: 137031
Buggy source:
private void addResultToIndicatorToRowMap(Indicator indicator,EMap<Indicator,AnalyzedDataSet> indicToRowMap,int maxNumberRows,int columnCount){
  Map<Object,List<Object[]>> dupMap=((DuplicateCountIndicator)indicator).getDuplicateMap();
  Iterator<Object> iterator=dupMap.keySet().iterator();
  while (iterator.hasNext()) {
    Object key=iterator.next();
    List<Object[]> valuelist=dupMap.get(key);
    if (valuelist.size() > 1) {
      List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,key);
      int recordIncrement=valueObjectList.size();
      for (      Object[] row : valuelist) {
        if (recordIncrement < maxNumberRows) {
          valueObjectList.add(row);
        }
 else {
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void addResultToIndicatorToRowMap(Indicator indicator,EMap<Indicator,AnalyzedDataSet> indicToRowMap){
  Map<Object,Object[]> dupMap=((DuplicateCountIndicator)indicator).getDuplicateMap();
  Set<Object> duplicateValues=((DuplicateCountIndicator)indicator).getDuplicateValues();
  Iterator<Object> iterator=duplicateValues.iterator();
  int maxNumberRows=analysis.getParameters().getMaxNumberRows();
  while (iterator.hasNext()) {
    Object key=iterator.next();
    Object[] valueArray=dupMap.get(key);
    if (valueArray != null) {
      List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,key);
      int NumberOfRecord=valueObjectList.size();
      if (NumberOfRecord < maxNumberRows) {
        valueObjectList.add(valueArray);
      }
 else {
        break;
      }
    }
  }
}
Program: 137033
Project: 137033
Buggy source:
public static <T>PageResult<Object[]> createPage(AbstractDB<T> db,Map<Long,T> indexMap,ColumnFilter filter,long fromIndex,long toIndex,long totalSize){
  List<Object[]> content=db.subList(fromIndex,toIndex,indexMap);
  if (filter != null) {
    content=filter.filterArray(content);
  }
  long total=totalSize;
  if (content.size() < total) {
    total=content.size();
  }
  return new PageResult<Object[]>(content,total);
}

Fixed version (ground truth):
public static <T>PageResult<Object[]> createPage(AbstractDB<T> db,Map<Long,T> indexMap,ColumnFilter filter,long fromIndex,long toIndex,long totalSize){
  List<Object[]> content=db.subList(fromIndex,toIndex,indexMap);
  if (filter != null) {
    content=filter.filterArray(content);
  }
  return new PageResult<Object[]>(content,totalSize);
}
Program: 137034
Project: 137034
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public PageResult<Object[]> loadPage(PageableController controller){
  long totalSize=itemsSize;
  long pageSize=controller.getPageSize();
  long pageIndex=controller.getPageOffset();
  long fromIndex=pageIndex;
  long toIndex=pageIndex + pageSize;
  if (toIndex > totalSize) {
    toIndex=totalSize;
  }
  if (dataValidator == null) {
    if (DBValueMap.class.isInstance(db)) {
      return MapDBPageListHelper.createPageByValue((DBValueMap)db,indexMap,columnFilter,fromIndex,toIndex);
    }
 else {
      return MapDBPageListHelper.createPage(db,indexMap,columnFilter,fromIndex,toIndex,totalSize);
    }
  }
 else {
    return MapDBPageListHelper.createPage(db,indexMap,dataValidator,fromIndex,toIndex,totalSize);
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public PageResult<Object[]> loadPage(PageableController controller){
  int dbSize=db.size();
  long totalSize=dbSize < itemsSize ? dbSize : itemsSize;
  long pageSize=controller.getPageSize();
  long pageIndex=controller.getPageOffset();
  long fromIndex=pageIndex;
  long toIndex=pageIndex + pageSize;
  if (toIndex > totalSize) {
    toIndex=totalSize;
  }
  if (dataValidator == null) {
    return MapDBPageListHelper.createPage(db,indexMap,columnFilter,fromIndex,toIndex,totalSize);
  }
 else {
    return MapDBPageListHelper.createPage(db,indexMap,dataValidator,fromIndex,toIndex,totalSize);
  }
}
Program: 137036
Project: 137036
Buggy source:
/** 
 * DataSet is used to be the input on the export wizard. unchecked is for the type of mapDB else will have a warning
 * @param controller
 * @return
 */
@SuppressWarnings("String_Node_Str") public Object getDataSetForMapDB(int pageSize){
  List<String> columnElementList=filterAdaptColumnHeader();
  columnHeader=new String[columnElementList.size()];
  int headerIndex=0;
  for (  String columnElement : columnElementList) {
    columnHeader[headerIndex++]=columnElement;
  }
  AbstractDB<?> mapDB=DrillDownUtils.getMapDB(dataEntity,analysis);
  AnalysisType analysisType=analysis.getParameters().getAnalysisType();
  if (AnalysisType.COLUMN_SET == analysisType) {
    Long size=getCurrentIndicatorResultSize();
    if (ColumnSetDBMap.class.isInstance(mapDB)) {
      return SqlExplorerUtils.getDefault().createMapDBColumnSetDataSet(columnHeader,(ColumnSetDBMap)mapDB,size,currIndicator,pageSize);
    }
  }
  if (DBSet.class.isInstance(mapDB)) {
    return SqlExplorerUtils.getDefault().createMapDBSetDataSet(columnHeader,(DBSet<Object>)mapDB,pageSize);
  }
 else {
    ColumnFilter columnFilter=getColumnFilter();
    Long itemSize=getItemSize(mapDB);
    return SqlExplorerUtils.getDefault().createMapDBDataSet(columnHeader,(DBMap<Object,List<Object>>)mapDB,pageSize,columnFilter,itemSize);
  }
}

Fixed version (ground truth):
/** 
 * DataSet is used to be the input on the export wizard. unchecked is for the type of mapDB else will have a warning
 * @param controller
 * @return
 */
@SuppressWarnings("String_Node_Str") public Object getDataSetForMapDB(int pageSize){
  List<String> columnElementList=filterAdaptColumnHeader();
  columnHeader=new String[columnElementList.size()];
  int headerIndex=0;
  for (  String columnElement : columnElementList) {
    columnHeader[headerIndex++]=columnElement;
  }
  AbstractDB<?> mapDB=getMapDB();
  AnalysisType analysisType=analysis.getParameters().getAnalysisType();
  if (AnalysisType.COLUMN_SET == analysisType) {
    Long size=getCurrentIndicatorResultSize();
    if (ColumnSetDBMap.class.isInstance(mapDB)) {
      return SqlExplorerUtils.getDefault().createMapDBColumnSetDataSet(columnHeader,(ColumnSetDBMap)mapDB,size,currIndicator,pageSize);
    }
  }
  if (DBSet.class.isInstance(mapDB)) {
    return SqlExplorerUtils.getDefault().createMapDBSetDataSet(columnHeader,(DBSet<Object>)mapDB,pageSize);
  }
 else {
    ColumnFilter columnFilter=getColumnFilter();
    Long itemSize=getItemSize(mapDB);
    return SqlExplorerUtils.getDefault().createMapDBDataSet(columnHeader,(DBMap<Object,List<Object>>)mapDB,pageSize,columnFilter,itemSize);
  }
}
Program: 137037
Project: 137037
Buggy source:
/** 
 * Get the result of current indicator. Which only be used by column Set analysis
 * @return
 */
public Long getCurrentIndicatorResultSize(){
  Long itemsSize=0l;
  if (isColumnSetIndicator()) {
    itemsSize=getColumnSetIndicatorResultSize();
  }
 else {
    itemsSize=currIndicator.getIntegerValue();
  }
  return itemsSize;
}

Fixed version (ground truth):
/** 
 * Get the result of current indicator.
 * @return
 */
private Long getCurrentIndicatorResultSize(){
  Long itemsSize=0l;
  if (isColumnSetIndicator()) {
    itemsSize=getColumnSetIndicatorResultSize();
  }
 else {
    itemsSize=getColumnIndicatorResultsize();
  }
  return itemsSize;
}
Program: 137038
Project: 137038
Buggy source:
/** 
 * Get index of column whiche will be used on the dirll down
 * @return
 */
public Integer[] getColumnIndexArray(){
  if (!DrillDownEditorInput.judgeMenuType(this.getMenuType(),DrillDownEditorInput.MENU_VALUE_TYPE)) {
    return null;
  }
  List<Integer> indexArray=new ArrayList<Integer>();
  Indicator indicator=this.getCurrIndicator();
  ModelElement analysisElement=indicator.getAnalyzedElement();
  int index=0;
  if (analysisElement instanceof TdColumn) {
    for (    TdColumn column : TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement().eContainer()))) {
      if (column.getName().equals(analysisElement.getName())) {
        indexArray.add(index);
      }
      index++;
    }
  }
 else   if (analysisElement instanceof MetadataColumn) {
    MetadataTable mTable=ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn)analysisElement);
    for (    MetadataColumn mColumn : mTable.getColumns()) {
      if (mColumn.getLabel().equals(analysisElement.getName())) {
        indexArray.add(index);
      }
      index++;
    }
  }
  return indexArray.toArray(new Integer[indexArray.size()]);
}

Fixed version (ground truth):
/** 
 * Get index of column whiche will be used on the dirll down. Note that One indicator only belong one column so that the array of retrun value just contain one element. And if we create new map for view values menu rather than used same map with view rows menu then method can be removed
 * @return
 */
public Integer[] getColumnIndexArray(){
  if (!DrillDownEditorInput.judgeMenuType(this.getMenuType(),DrillDownEditorInput.MENU_VALUE_TYPE) || DuplicateCountIndicator.class.isInstance(currIndicator)) {
    return null;
  }
  List<Integer> indexArray=new ArrayList<Integer>();
  Indicator indicator=this.getCurrIndicator();
  ModelElement analysisElement=indicator.getAnalyzedElement();
  int index=0;
  if (analysisElement instanceof TdColumn) {
    TdTable tdTable=ColumnHelper.getColumnOwnerAsTdTable((TdColumn)analysisElement);
    for (    TdColumn column : TableHelper.getColumns(tdTable)) {
      if (column.getName().equals(analysisElement.getName())) {
        indexArray.add(index);
        break;
      }
      index++;
    }
  }
 else   if (analysisElement instanceof MetadataColumn) {
    MetadataTable mTable=ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn)analysisElement);
    for (    MetadataColumn mColumn : mTable.getColumns()) {
      if (mColumn.getLabel().equals(analysisElement.getName())) {
        indexArray.add(index);
        break;
      }
      index++;
    }
  }
  return indexArray.toArray(new Integer[indexArray.size()]);
}
Program: 137039
Project: 137039
Buggy source:
/** 
 * DOC talend Comment method "getPageSize".
 * @param controller
 * @return
 */
private Long getItemSize(AbstractDB<?> mapDB){
  if (DrillDownEditorInput.judgeMenuType(getMenuType(),DrillDownEditorInput.MENU_VALUE_TYPE)) {
    return getCurrentIndicatorResultSize();
  }
 else {
    return Long.valueOf(mapDB.size());
  }
}

Fixed version (ground truth):
/** 
 * Get the result of current indicator.
 * @return if view values then return result of current indicator else return the size of the mapDB
 */
public Long getItemSize(AbstractDB<?> mapDB){
  if (judgeMenuType(getMenuType(),DrillDownEditorInput.MENU_VALUE_TYPE)) {
    return getCurrentIndicatorResultSize();
  }
 else {
    return Long.valueOf(mapDB.size());
  }
}
Program: 137041
Project: 137041
Buggy source:
/** 
 * create the nattable every time when the user select some columns
 * @param columns
 * @param listOfData
 */
public TControl createTable(Composite parentContainer,ModelElement[] columns,List<Object[]> listOfData){
  reset();
  initTableProperty(columns);
  List<Object[]> results=listOfData == null ? new ArrayList<Object[]>() : listOfData;
  if (results.size() < 1) {
    results.add(getEmptyRow());
  }
  isContainGID=results.get(0).length > additionalColumnPosition.GIDindex;
  if (isContainGID) {
    initGIDMap(results);
    if (minGrpSize > 1) {
      return hideGroup(parentContainer,results);
    }
  }
  return createTableControl(parentContainer,results);
}

Fixed version (ground truth):
/** 
 * create the nattable every time when the user select some columns
 * @param columns
 * @param listOfData
 */
public TControl createTable(Composite parentContainer,ModelElement[] columns,List<Object[]> listOfData){
  reset();
  initTableProperty(columns);
  List<Object[]> results=listOfData == null ? new ArrayList<Object[]>() : listOfData;
  if (results.size() < 1) {
    results.add(getEmptyRow(columns.length));
  }
  isContainGID=results.get(0).length > additionalColumnPosition.GIDindex;
  if (isContainGID) {
    initGIDMap(results);
    if (minGrpSize > 1) {
      return hideGroup(parentContainer,results);
    }
  }
  return createTableControl(parentContainer,results);
}
Program: 137042
Project: 137042
Buggy source:
/** 
 * when the data is empty, the column can not response the click event, so we need to add an empty row to it.
 * @return
 */
private Object[] getEmptyRow(){
  Object[] emptyRow=new Object[propertyNames.length];
  for (int i=0; i < propertyNames.length; i++) {
    emptyRow[i]=StringUtils.EMPTY;
  }
  return emptyRow;
}

Fixed version (ground truth):
/** 
 * when the data is empty, the column can not response the click event, so we need to add an empty row to it.
 * @param length
 * @return
 */
private Object[] getEmptyRow(int length){
  Object[] emptyRow=new Object[length];
  for (int i=0; i < length; i++) {
    emptyRow[i]=StringUtils.EMPTY;
  }
  return emptyRow;
}
Program: 137043
Project: 137043
Buggy source:
public static <K,V>PageResult<Object[]> createPageByValue(DBValueMap<K,V> db,PageableController controller,SortProcessor processor,Map<Long,K> indexMap,long itemsSize,ColumnFilter filter){
  long totalSize=itemsSize;
  long pageSize=controller.getPageSize();
  long pageIndex=controller.getPageOffset();
  long fromIndex=pageIndex;
  long toIndex=pageIndex + pageSize;
  if (toIndex > totalSize) {
    toIndex=totalSize;
  }
  List<Object[]> content=((DBMap<K,V>)db).subValueList(fromIndex,toIndex,indexMap);
  if (filter != null) {
    content=filter.filterArray(content);
  }
  return new PageResult<Object[]>(content,content.size());
}

Fixed version (ground truth):
public static <K,V>PageResult<Object[]> createPageByValue(DBValueMap<K,V> db,Map<Long,K> indexMap,ColumnFilter filter,long fromIndex,long toIndex){
  List<Object[]> content=((DBMap<K,V>)db).subValueList(fromIndex,toIndex,indexMap);
  if (filter != null) {
    content=filter.filterArray(content);
  }
  return new PageResult<Object[]>(content,content.size());
}
Program: 137044
Project: 137044
Buggy source:
public static <T>PageResult<Object[]> createPage(AbstractDB<T> db,PageableController controller,SortProcessor processor,Map<Long,T> indexMap,long itemsSize,DataValidation dataValidator){
  long totalSize=itemsSize;
  long pageSize=controller.getPageSize();
  long pageIndex=controller.getPageOffset();
  long fromIndex=pageIndex;
  long toIndex=pageIndex + pageSize;
  if (toIndex > totalSize) {
    toIndex=totalSize;
  }
  List<Object[]> content=db.subList(fromIndex,toIndex,indexMap,dataValidator);
  if (content.size() < pageSize) {
    totalSize=content.size();
  }
  return new PageResult<Object[]>(content,totalSize);
}

Fixed version (ground truth):
public static <T>PageResult<Object[]> createPage(AbstractDB<T> db,Map<Long,T> indexMap,ColumnFilter filter,long fromIndex,long toIndex,long totalSize){
  List<Object[]> content=db.subList(fromIndex,toIndex,indexMap);
  if (filter != null) {
    content=filter.filterArray(content);
  }
  long total=totalSize;
  if (content.size() < total) {
    total=content.size();
  }
  return new PageResult<Object[]>(content,total);
}
Program: 137045
Project: 137045
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public PageResult<Object[]> loadPage(PageableController controller){
  if (dataValidator == null) {
    if (DBValueMap.class.isInstance(db)) {
      return MapDBPageListHelper.createPageByValue((DBValueMap)db,controller,indexMap,itemsSize,columnFilter);
    }
    return MapDBPageListHelper.createPage(db,controller,indexMap,itemsSize,columnFilter);
  }
 else {
    return MapDBPageListHelper.createPage(db,controller,indexMap,itemsSize,dataValidator);
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public PageResult<Object[]> loadPage(PageableController controller){
  long totalSize=itemsSize;
  long pageSize=controller.getPageSize();
  long pageIndex=controller.getPageOffset();
  long fromIndex=pageIndex;
  long toIndex=pageIndex + pageSize;
  if (toIndex > totalSize) {
    toIndex=totalSize;
  }
  if (dataValidator == null) {
    if (DBValueMap.class.isInstance(db)) {
      return MapDBPageListHelper.createPageByValue((DBValueMap)db,indexMap,columnFilter,fromIndex,toIndex);
    }
 else {
      return MapDBPageListHelper.createPage(db,indexMap,columnFilter,fromIndex,toIndex,totalSize);
    }
  }
 else {
    return MapDBPageListHelper.createPage(db,indexMap,dataValidator,fromIndex,toIndex,totalSize);
  }
}
Program: 137048
Project: 137048
Buggy source:
/** 
 * Test method for  {@link org.talend.dataquality.record.linkage.ui.composite.utils.MatchRuleAnlaysisUtils#sortDataByColumn(org.talend.dataquality.record.linkage.ui.composite.table.SortState,java.util.List,java.util.List)}.
 */
public void testSortDataByColumn_StringAsDouble(){
  sortState.getNextSortDirection();
  sortState.setGrpSizeIndex(0);
  String[] array={"String_Node_Str"};
  String[] array2={"String_Node_Str"};
  String[] array4={"String_Node_Str"};
  String[] array3={"String_Node_Str"};
  sortData.add(array);
  sortData.add(array2);
  sortData.add(array4);
  sortData.add(array3);
  sqlDataType.setName("String_Node_Str");
  sqlDataType.setJavaDataType(Types.REAL);
  List<Object[]> sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(4,sortResult.size());
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array4[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array3[0]),0);
  sortState.setSelectedColumnIndex(0);
  sortState.getNextSortDirection();
  sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array2[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array3[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array4[0]),0);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dataquality.record.linkage.ui.composite.utils.MatchRuleAnlaysisUtils#sortDataByColumn(org.talend.dataquality.record.linkage.ui.composite.table.SortState,java.util.List,java.util.List)}.
 */
public void testSortDataByColumn_StringAsDouble(){
  sortState.getNextSortDirection();
  String[] array={"String_Node_Str"};
  String[] array2={"String_Node_Str"};
  String[] array4={"String_Node_Str"};
  String[] array3={"String_Node_Str"};
  sortData.add(array);
  sortData.add(array2);
  sortData.add(array4);
  sortData.add(array3);
  sqlDataType.setName("String_Node_Str");
  sqlDataType.setJavaDataType(Types.REAL);
  List<Object[]> sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(4,sortResult.size());
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array4[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array3[0]),0);
  sortState.setSelectedColumnIndex(0);
  sortState.getNextSortDirection();
  sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array2[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array3[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array4[0]),0);
}
Program: 137049
Project: 137049
Buggy source:
/** 
 * DOC yyin Comment method "setUp".
 * @throws java.lang.Exception
 */
protected void setUp() throws Exception {
  sortState=new SortState();
  sortState.setSelectedColumnIndex(0);
  sortState.setSelectedColumnName("String_Node_Str");
  sortData=new ArrayList<Object[]>();
  columns=new ArrayList<ModelElement>();
  tdColumn.setSqlDataType(sqlDataType);
  columns.add(tdColumn);
}

Fixed version (ground truth):
/** 
 * DOC yyin Comment method "setUp".
 * @throws java.lang.Exception
 */
@Override protected void setUp() throws Exception {
  sortState=new SortState(0);
  sortState.setSelectedColumnIndex(0);
  sortState.setSelectedColumnName("String_Node_Str");
  sortData=new ArrayList<Object[]>();
  columns=new ArrayList<ModelElement>();
  tdColumn.setSqlDataType(sqlDataType);
  columns.add(tdColumn);
}
Program: 137050
Project: 137050
Buggy source:
/** 
 * Test method for  {@link org.talend.dataquality.record.linkage.ui.composite.utils.MatchRuleAnlaysisUtils#sortDataByColumn(org.talend.dataquality.record.linkage.ui.composite.table.SortState,java.util.List,java.util.List)}.
 */
public void testSortDataByColumn_GroupSize(){
  sortState.getNextSortDirection();
  sortState.setGrpSizeIndex(0);
  String[] array={"String_Node_Str"};
  String[] array2={"String_Node_Str"};
  String[] array4={"String_Node_Str"};
  String[] array3={"String_Node_Str"};
  sortData.add(array);
  sortData.add(array2);
  sortData.add(array4);
  sortData.add(array3);
  sqlDataType.setName("String_Node_Str");
  sqlDataType.setJavaDataType(Types.VARCHAR);
  List<Object[]> sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(4,sortResult.size());
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array4[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array3[0]),0);
  sortState.setSelectedColumnIndex(0);
  sortState.getNextSortDirection();
  sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array2[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array3[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array4[0]),0);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dataquality.record.linkage.ui.composite.utils.MatchRuleAnlaysisUtils#sortDataByColumn(org.talend.dataquality.record.linkage.ui.composite.table.SortState,java.util.List,java.util.List)}.
 */
public void testSortDataByColumn_GroupSize(){
  sortState.getNextSortDirection();
  String[] array={"String_Node_Str"};
  String[] array2={"String_Node_Str"};
  String[] array4={"String_Node_Str"};
  String[] array3={"String_Node_Str"};
  sortData.add(array);
  sortData.add(array2);
  sortData.add(array4);
  sortData.add(array3);
  sqlDataType.setName("String_Node_Str");
  sqlDataType.setJavaDataType(Types.VARCHAR);
  List<Object[]> sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(4,sortResult.size());
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array4[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array3[0]),0);
  sortState.setSelectedColumnIndex(0);
  sortState.getNextSortDirection();
  sortResult=MatchRuleAnlaysisUtils.sortDataByColumn(sortState,sortData,columns);
  Assert.assertEquals(((String)sortResult.get(0)[0]).compareTo(array2[0]),0);
  Assert.assertEquals(((String)sortResult.get(1)[0]).compareTo(array3[0]),0);
  Assert.assertEquals(((String)sortResult.get(2)[0]).compareTo(array4[0]),0);
}
Program: 137051
Project: 137051
Buggy source:
/** 
 * DOC yyin Comment method "tearDown".
 * @throws java.lang.Exception
 */
protected void tearDown() throws Exception {
  sortData=null;
  columns=null;
}

Fixed version (ground truth):
/** 
 * DOC yyin Comment method "tearDown".
 * @throws java.lang.Exception
 */
@Override protected void tearDown() throws Exception {
  sortData=null;
  columns=null;
}
Program: 137053
Project: 137053
Buggy source:
/** 
 * DOC qiongli Comment method "initializeCsvReader".
 * @param csvReader
 * @param connection
 */
public static void initializeCsvReader(DelimitedFileConnection delimitedFileconnection,CSVReader csvReader){
  String rowSep=JavaSqlFactory.getRowSeparatorValue(delimitedFileconnection);
  if (rowSep != null && !rowSep.equals(ROW_SEPARATOR_N) && !rowSep.equals(ROW_SEPARATOR_R)) {
    csvReader.setSeparator(ParameterUtil.trimParameter(rowSep).charAt(0));
  }
  csvReader.setSkipEmptyRecords(true);
  String textEnclosure=delimitedFileconnection.getTextEnclosure();
  if (textEnclosure != null && textEnclosure.length() > 0) {
    csvReader.setQuoteChar(ParameterUtil.trimParameter(textEnclosure).charAt(0));
  }
 else {
    csvReader.setQuoteChar(QUOTECHAR_NOTVALID);
  }
  String escapeChar=delimitedFileconnection.getEscapeChar();
  if (escapeChar == null || escapeChar.equals(ESCAPECHAR1) || escapeChar.equals(ESCAPECHAR2)) {
    csvReader.setEscapeChar(ESCAPE_CHAR);
  }
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "initializeCsvReader".
 * @param csvReader
 * @param connection
 */
public static void initializeCsvReader(DelimitedFileConnection delimitedFileconnection,CSVReader csvReader){
  String rowSep=JavaSqlFactory.getRowSeparatorValue(delimitedFileconnection);
  if (rowSep != null && !rowSep.equals(ROW_SEPARATOR_N) && !rowSep.equals(ROW_SEPARATOR_R)) {
    csvReader.setSeparator(ParameterUtil.trimParameter(rowSep).charAt(0));
  }
  csvReader.setSkipEmptyRecords(true);
  String textEnclosure=delimitedFileconnection.getTextEnclosure();
  if (textEnclosure != null && textEnclosure.length() > 0) {
    csvReader.setQuoteChar(ParameterUtil.trimParameter(textEnclosure).charAt(0));
  }
  String escapeChar=delimitedFileconnection.getEscapeChar();
  if (escapeChar == null || escapeChar.equals(ESCAPECHAR1) || escapeChar.equals(ESCAPECHAR2)) {
    csvReader.setEscapeChar(ESCAPE_CHAR);
  }
}
Program: 137054
Project: 137054
Buggy source:
private void useCsvReader(CSVReader csvReader,File file,DelimitedFileConnection dfCon,List<ModelElement> analysisElementList) throws Exception {
  FileUtils.initializeCsvReader(dfCon,csvReader);
  long currentRecord=0;
  int limitValue=JavaSqlFactory.getLimitValue(dfCon);
  int headValue=JavaSqlFactory.getHeadValue(dfCon);
  for (int i=0; i < headValue && csvReader.readNext(); i++) {
  }
  while (csvReader.readNext()) {
    currentRecord=csvReader.getCurrentRecord();
    if (!continueRun() || limitValue != -1 && currentRecord > limitValue - 1) {
      break;
    }
    if (dfCon.isFirstLineCaption() && currentRecord == 0) {
      continue;
    }
    String[] rowValues=csvReader.getValues();
    this.orgnizeObjectsToHandel(dfCon.getFilePath(),rowValues,currentRecord + 1,analysisElementList,dfCon.getFieldSeparatorValue());
  }
}

Fixed version (ground truth):
private void useCsvReader(CSVReader csvReader,File file,DelimitedFileConnection dfCon,List<ModelElement> analysisElementList) throws Exception {
  FileUtils.initializeCsvReader(dfCon,csvReader);
  long currentRecord=0;
  int limitValue=JavaSqlFactory.getLimitValue(dfCon);
  int headValue=JavaSqlFactory.getHeadValue(dfCon);
  for (int i=0; i < headValue && csvReader.readNext(); i++) {
  }
  while (csvReader.readNext()) {
    currentRecord++;
    if (!continueRun() || limitValue != -1 && currentRecord > limitValue) {
      break;
    }
    String[] rowValues=csvReader.getValues();
    this.orgnizeObjectsToHandel(dfCon.getFilePath(),rowValues,currentRecord,analysisElementList,dfCon.getFieldSeparatorValue());
  }
}
Program: 137055
Project: 137055
Buggy source:
private void useCsvReader(File file,DelimitedFileConnection dfCon,List<ModelElement> analysisElementList,List<MetadataColumn> columnElementList,EMap<Indicator,AnalyzedDataSet> indicToRowMap){
  int limitValue=JavaSqlFactory.getLimitValue(delimitedFileconnection);
  int headValue=JavaSqlFactory.getHeadValue(delimitedFileconnection);
  CSVReader csvReader=null;
  try {
    csvReader=FileUtils.createCsvReader(file,delimitedFileconnection);
    FileUtils.initializeCsvReader(delimitedFileconnection,csvReader);
    for (int i=0; i < headValue && csvReader.readNext(); i++) {
    }
    String[] rowValues=null;
    long currentRecord=0;
    while (csvReader.readNext()) {
      currentRecord=csvReader.getCurrentRecord();
      if (!continueRun() || limitValue != -1 && currentRecord > limitValue - 1) {
        break;
      }
      if (delimitedFileconnection.isFirstLineCaption() && currentRecord == 0) {
        continue;
      }
      rowValues=csvReader.getValues();
      handleByARow(rowValues,currentRecord + 1,analysisElementList,columnElementList,indicToRowMap);
    }
  }
 catch (  IOException e) {
    log.error(e,e);
  }
 finally {
    if (csvReader != null) {
      try {
        csvReader.close();
      }
 catch (      IOException e) {
        log.error(e,e);
      }
    }
  }
}

Fixed version (ground truth):
private void useCsvReader(File file,DelimitedFileConnection dfCon,List<ModelElement> analysisElementList,List<MetadataColumn> columnElementList,EMap<Indicator,AnalyzedDataSet> indicToRowMap){
  int limitValue=JavaSqlFactory.getLimitValue(delimitedFileconnection);
  int headValue=JavaSqlFactory.getHeadValue(delimitedFileconnection);
  CSVReader csvReader=null;
  try {
    csvReader=FileUtils.createCsvReader(file,delimitedFileconnection);
    FileUtils.initializeCsvReader(delimitedFileconnection,csvReader);
    for (int i=0; i < headValue && csvReader.readNext(); i++) {
    }
    String[] rowValues=null;
    long currentRecord=0;
    while (csvReader.readNext()) {
      currentRecord++;
      if (!continueRun() || limitValue != -1 && currentRecord > limitValue) {
        break;
      }
      rowValues=csvReader.getValues();
      handleByARow(rowValues,currentRecord,analysisElementList,columnElementList,indicToRowMap);
    }
  }
 catch (  IOException e) {
    log.error(e,e);
  }
 finally {
    if (csvReader != null) {
      try {
        csvReader.close();
      }
 catch (      IOException e) {
        log.error(e,e);
      }
    }
  }
}