Program: 138614
Project: 138614
Buggy source:
protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  Set<String> columns=getAnalyzedElements();
  List<String> columnlist=sortColumnName(columns,sqlStatement);
  if (columnlist.isEmpty()) {
    ok.setReturnCode(Messages.getString("String_Node_Str"),false);
    return ok;
  }
  Map<String,String> columnlistMap=buildColumnListMap(columnlist);
  Statement statement=null;
  statement=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
  statement.setFetchSize(fetchSize);
  if (continueRun()) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + sqlStatement);
    }
    statement.execute(sqlStatement);
  }
  ResultSet resultSet=statement.getResultSet();
  if (resultSet == null) {
    String mess="String_Node_Str" + sqlStatement;
    log.warn(mess);
    ok.setReturnCode(mess,false);
    return ok;
  }
  AnalysisResult anaResult=analysis.getResults();
  EMap<Indicator,AnalyzedDataSet> indicToRowMap=anaResult.getIndicToRowMap();
  indicToRowMap.clear();
  int recordIncrement=0;
  int rowNum=0;
  label:   while (resultSet.next()) {
    for (int i=0; i < columnlist.size(); i++) {
      String col=columnlist.get(i);
      List<Indicator> indicators=getIndicators(col);
      col=columnlistMap.get(columnlist.get(i));
      Object object=resultSet.getObject(col);
      if (object != null && !(object instanceof String) && object.toString().indexOf("String_Node_Str") > -1) {
        object=resultSet.getTimestamp(col);
      }
      for (      Indicator indicator : indicators) {
        if (!continueRun()) {
          break label;
        }
        indicator.handle(object);
        AnalyzedDataSet analyzedDataSet=indicToRowMap.get(indicator);
        if (analyzedDataSet == null) {
          analyzedDataSet=AnalysisFactory.eINSTANCE.createAnalyzedDataSet();
          indicToRowMap.put(indicator,analyzedDataSet);
          analyzedDataSet.setDataCount(analysis.getParameters().getMaxNumberRows());
          analyzedDataSet.setRecordSize(0);
        }
        if (analysis.getParameters().isStoreData() && indicator.mustStoreRow()) {
          List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,object);
          recordIncrement=valueObjectList.size();
          for (int j=0; j < resultSet.getMetaData().getColumnCount(); j++) {
            List<TdColumn> columnList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement().eContainer()));
            String newcol=columnList.get(j).getName();
            Object newobject=resultSet.getObject(newcol);
            if (newobject != null && !(newobject instanceof String) && newobject.toString().indexOf("String_Node_Str") > -1) {
              newobject=resultSet.getTimestamp(newcol);
            }
            if (recordIncrement < analysis.getParameters().getMaxNumberRows()) {
              if (recordIncrement < valueObjectList.size()) {
                valueObjectList.get(recordIncrement)[j]=newobject;
              }
 else {
                Object[] valueObject=new Object[resultSet.getMetaData().getColumnCount()];
                valueObject[j]=newobject;
                valueObjectList.add(valueObject);
              }
            }
          }
        }
 else         if (indicator instanceof UniqueCountIndicator && analysis.getResults().getIndicToRowMap().get(indicator).getData() != null) {
          List<Object[]> removeValueObjectList=analysis.getResults().getIndicToRowMap().get(indicator).getData();
          List<TdColumn> columnElementList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement().eContainer()));
          int offsetting=columnElementList.indexOf(indicator.getAnalyzedElement());
          for (          Object[] dataObject : removeValueObjectList) {
            if (dataObject[offsetting].equals(object)) {
              removeValueObjectList.remove(dataObject);
              break;
            }
          }
        }
      }
    }
    rowNum++;
  }
  resultSet.close();
  connection.close();
  return ok;
}

Fixed version (ground truth):
protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  Set<String> columns=getAnalyzedElements();
  List<String> columnlist=sortColumnName(columns,sqlStatement);
  if (columnlist.isEmpty()) {
    ok.setReturnCode(Messages.getString("String_Node_Str"),false);
    return ok;
  }
  Map<String,String> columnlistMap=buildColumnListMap(columnlist);
  Statement statement=null;
  statement=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
  statement.setFetchSize(fetchSize);
  if (continueRun()) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + sqlStatement);
    }
    statement.execute(sqlStatement);
  }
  ResultSet resultSet=statement.getResultSet();
  if (resultSet == null) {
    String mess="String_Node_Str" + sqlStatement;
    log.warn(mess);
    ok.setReturnCode(mess,false);
    return ok;
  }
  AnalysisResult anaResult=analysis.getResults();
  EMap<Indicator,AnalyzedDataSet> indicToRowMap=anaResult.getIndicToRowMap();
  indicToRowMap.clear();
  int recordIncrement=0;
  label:   while (resultSet.next()) {
    for (int i=0; i < columnlist.size(); i++) {
      String col=columnlist.get(i);
      List<Indicator> indicators=getIndicators(col);
      col=columnlistMap.get(columnlist.get(i));
      Object object=resultSet.getObject(col);
      if (object != null && !(object instanceof String) && object.toString().indexOf("String_Node_Str") > -1) {
        object=resultSet.getTimestamp(col);
      }
      for (      Indicator indicator : indicators) {
        if (!continueRun()) {
          break label;
        }
        indicator.handle(object);
        AnalyzedDataSet analyzedDataSet=indicToRowMap.get(indicator);
        if (analyzedDataSet == null) {
          analyzedDataSet=AnalysisFactory.eINSTANCE.createAnalyzedDataSet();
          indicToRowMap.put(indicator,analyzedDataSet);
          analyzedDataSet.setDataCount(analysis.getParameters().getMaxNumberRows());
          analyzedDataSet.setRecordSize(0);
        }
        if (analysis.getParameters().isStoreData() && indicator.mustStoreRow()) {
          List<Object[]> valueObjectList=initDataSet(indicator,indicToRowMap,object);
          recordIncrement=valueObjectList.size();
          for (int j=0; j < resultSet.getMetaData().getColumnCount(); j++) {
            List<TdColumn> columnList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement().eContainer()));
            String newcol=columnList.get(j).getName();
            Object newobject=resultSet.getObject(newcol);
            if (newobject != null && !(newobject instanceof String) && newobject.toString().indexOf("String_Node_Str") > -1) {
              newobject=resultSet.getTimestamp(newcol);
            }
            if (recordIncrement < analysis.getParameters().getMaxNumberRows()) {
              if (recordIncrement < valueObjectList.size()) {
                valueObjectList.get(recordIncrement)[j]=newobject;
              }
 else {
                Object[] valueObject=new Object[resultSet.getMetaData().getColumnCount()];
                valueObject[j]=newobject;
                valueObjectList.add(valueObject);
              }
            }
          }
        }
 else         if (indicator instanceof UniqueCountIndicator && analysis.getResults().getIndicToRowMap().get(indicator).getData() != null) {
          List<Object[]> removeValueObjectList=analysis.getResults().getIndicToRowMap().get(indicator).getData();
          List<TdColumn> columnElementList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement().eContainer()));
          int offsetting=columnElementList.indexOf(indicator.getAnalyzedElement());
          for (          Object[] dataObject : removeValueObjectList) {
            if (dataObject[offsetting].equals(object)) {
              removeValueObjectList.remove(dataObject);
              break;
            }
          }
        }
      }
    }
  }
  resultSet.close();
  connection.close();
  return ok;
}