Program: 137260
Project: 137260
Buggy source:
private void useCsvReader(File file,DelimitedFileConnection delimitedFileconnection,List<ModelElement> analysisElementList){
  int limitValue=AnalysisExecutorHelper.getLimitValue(delimitedFileconnection);
  int headValue=AnalysisExecutorHelper.getHeadValue(delimitedFileconnection);
  CsvReader csvReader=null;
  try {
    csvReader=AnalysisExecutorHelper.createCsvReader(file,delimitedFileconnection);
    AnalysisExecutorHelper.initializeCsvReader(delimitedFileconnection,csvReader);
    int analysedColumnIndex[]=new int[analysisElementList.size()];
    List<String> columnLabels=new ArrayList<String>();
    for (int i=0; i < headValue && csvReader.readRecord(); i++) {
      Collections.addAll(columnLabels,csvReader.getValues());
    }
    for (int j=0; j < analysisElementList.size(); j++) {
      analysedColumnIndex[j]=columnLabels.indexOf(analysisElementList.get(j).getName());
    }
    long currentRecord=0;
    while (csvReader.readRecord()) {
      currentRecord=csvReader.getCurrentRecord();
      if (limitValue != -1 && currentRecord > limitValue - 1) {
        break;
      }
      if (delimitedFileconnection.isFirstLineCaption() && currentRecord == 0) {
        continue;
      }
      String[] values=csvReader.getValues();
      String[] analysedValues=new String[analysisElementList.size()];
      for (int i=0; i < analysedColumnIndex.length; i++) {
        analysedValues[i]=values[analysedColumnIndex[i]];
      }
      handleRow(analysedValues);
    }
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
 finally {
    if (csvReader != null) {
      csvReader.close();
    }
  }
}

Fixed version (ground truth):
private void useCsvReader(File file,DelimitedFileConnection delimitedFileconnection,List<ModelElement> analysisElementList){
  int limitValue=JavaSqlFactory.getLimitValue(delimitedFileconnection);
  int headValue=JavaSqlFactory.getHeadValue(delimitedFileconnection);
  CsvReader csvReader=null;
  try {
    csvReader=AnalysisExecutorHelper.createCsvReader(file,delimitedFileconnection);
    AnalysisExecutorHelper.initializeCsvReader(delimitedFileconnection,csvReader);
    int analysedColumnIndex[]=new int[analysisElementList.size()];
    List<String> columnLabels=new ArrayList<String>();
    for (int i=0; i < headValue && csvReader.readRecord(); i++) {
      Collections.addAll(columnLabels,csvReader.getValues());
    }
    for (int j=0; j < analysisElementList.size(); j++) {
      analysedColumnIndex[j]=columnLabels.indexOf(analysisElementList.get(j).getName());
    }
    long currentRecord=0;
    while (csvReader.readRecord()) {
      currentRecord=csvReader.getCurrentRecord();
      if (limitValue != -1 && currentRecord > limitValue - 1) {
        break;
      }
      if (delimitedFileconnection.isFirstLineCaption() && currentRecord == 0) {
        continue;
      }
      String[] values=csvReader.getValues();
      String[] analysedValues=new String[analysisElementList.size()];
      for (int i=0; i < analysedColumnIndex.length; i++) {
        analysedValues[i]=values[analysedColumnIndex[i]];
      }
      handleRow(analysedValues);
    }
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
 finally {
    if (csvReader != null) {
      csvReader.close();
    }
  }
}