Program: 137848
Project: 137848
Buggy source:
@Override protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  dataProvider=this.getDataManager();
  if (this.elementToIndicators.values().isEmpty()) {
    String msg=Messages.getString("String_Node_Str");
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  elementIndics=this.elementToIndicators.values().iterator().next();
  if (elementIndics.isEmpty()) {
    String msg=Messages.getString("String_Node_Str",dataProvider);
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  ConnectionIndicator connectionIndicator=getConnectionIndicator();
  this.resetCounts(connectionIndicator);
  List<Catalog> catalogs=ConnectionHelper.getCatalogs(dataProvider);
  if (isTos(dataProvider)) {
    cleanUpCatalog(catalogs);
  }
  this.getMonitor().beginTask("String_Node_Str",100);
  int temp=0;
  if (catalogs.isEmpty()) {
    List<Schema> schemata=ConnectionHelper.getSchema(dataProvider);
    for (    Schema tdSchema : schemata) {
      if (!checkSchema(tdSchema)) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdSchema.getName()),false);
        return ok;
      }
    }
    for (int i=0; i < schemata.size(); i++) {
      Schema tdSchema=schemata.get(i);
      this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + tdSchema.getName());
      evalSchemaIndic(tdSchema,ok);
      int current=(i + 1) * 100 / catalogs.size();
      if (current > temp) {
        this.getMonitor().worked(current - temp);
        temp=current;
      }
    }
  }
 else {
    for (    Catalog tdCatalog : catalogs) {
      if (!checkCatalog(tdCatalog.getName())) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdCatalog.getName()),false);
        return ok;
      }
    }
    for (int i=0; i < catalogs.size(); i++) {
      if (this.continueRun()) {
        Catalog tdCatalog=catalogs.get(i);
        String catName=tdCatalog.getName();
        this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + catName);
        try {
          connection.setCatalog(catName);
        }
 catch (        Exception e) {
          log.warn("String_Node_Str" + sqlStatement,e);
        }
        CatalogIndicator catalogIndic=SchemaFactory.eINSTANCE.createCatalogIndicator();
        DefinitionHandler.getInstance().setDefaultIndicatorDefinition(catalogIndic);
        List<Schema> schemas=CatalogHelper.getSchemas(tdCatalog);
        if (schemas.isEmpty()) {
          evalCatalogIndic(catalogIndic,tdCatalog,ok);
        }
 else {
          catalogIndic.setAnalyzedElement(tdCatalog);
          for (          Schema tdSchema : schemas) {
            if (this.continueRun()) {
              this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + catName+ "String_Node_Str"+ tdSchema.getName());
              SchemaIndicator schemaIndic=SchemaFactory.eINSTANCE.createSchemaIndicator();
              DefinitionHandler.getInstance().setDefaultIndicatorDefinition(schemaIndic);
              evalSchemaIndicLow(catalogIndic,schemaIndic,tdCatalog,tdSchema,ok);
            }
          }
          catalogIndic.setSchemaCount(schemas.size());
        }
        int current=(i + 1) * 100 / catalogs.size();
        if (current > temp) {
          this.getMonitor().worked(current - temp);
          temp=current;
        }
      }
    }
    this.getMonitor().done();
  }
  if (log.isDebugEnabled()) {
    printCounts(connectionIndicator);
  }
  return ok;
}

Fixed version (ground truth):
@Override protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  dataProvider=this.getDataManager();
  if (this.elementToIndicators.values().isEmpty()) {
    String msg=Messages.getString("String_Node_Str");
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  elementIndics=this.elementToIndicators.values().iterator().next();
  if (elementIndics.isEmpty()) {
    String msg=Messages.getString("String_Node_Str",dataProvider);
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  ConnectionIndicator connectionIndicator=getConnectionIndicator();
  this.resetCounts(connectionIndicator);
  List<Catalog> catalogs=ConnectionHelper.getCatalogs(dataProvider);
  if (isTos(dataProvider)) {
    cleanUpCatalog(catalogs);
  }
  this.getMonitor().beginTask("String_Node_Str",100);
  int temp=0;
  if (catalogs.isEmpty()) {
    List<Schema> schemata=ConnectionHelper.getSchema(dataProvider);
    for (    Schema tdSchema : schemata) {
      if (!checkSchema(tdSchema)) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdSchema.getName()),false);
        return ok;
      }
    }
    for (int i=0; i < schemata.size(); i++) {
      Schema tdSchema=schemata.get(i);
      this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + tdSchema.getName());
      evalSchemaIndic(tdSchema,ok);
      int current=(i + 1) * 100 / catalogs.size();
      if (current > temp) {
        this.getMonitor().worked(current - temp);
        temp=current;
      }
    }
  }
 else {
    for (    Catalog tdCatalog : catalogs) {
      if (!checkCatalog(tdCatalog.getName())) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdCatalog.getName()),false);
        return ok;
      }
    }
    for (int i=0; i < catalogs.size(); i++) {
      if (this.continueRun()) {
        Catalog tdCatalog=catalogs.get(i);
        String catName=tdCatalog.getName();
        this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + catName);
        if (dbms().supportCatalogSelection()) {
          connection.setCatalog(catName);
        }
        CatalogIndicator catalogIndic=SchemaFactory.eINSTANCE.createCatalogIndicator();
        DefinitionHandler.getInstance().setDefaultIndicatorDefinition(catalogIndic);
        List<Schema> schemas=CatalogHelper.getSchemas(tdCatalog);
        if (schemas.isEmpty()) {
          evalCatalogIndic(catalogIndic,tdCatalog,ok);
        }
 else {
          catalogIndic.setAnalyzedElement(tdCatalog);
          for (          Schema tdSchema : schemas) {
            if (this.continueRun()) {
              this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + catName+ "String_Node_Str"+ tdSchema.getName());
              SchemaIndicator schemaIndic=SchemaFactory.eINSTANCE.createSchemaIndicator();
              DefinitionHandler.getInstance().setDefaultIndicatorDefinition(schemaIndic);
              evalSchemaIndicLow(catalogIndic,schemaIndic,tdCatalog,tdSchema,ok);
            }
          }
          catalogIndic.setSchemaCount(schemas.size());
        }
        int current=(i + 1) * 100 / catalogs.size();
        if (current > temp) {
          this.getMonitor().worked(current - temp);
          temp=current;
        }
      }
    }
    this.getMonitor().done();
  }
  if (log.isDebugEnabled()) {
    printCounts(connectionIndicator);
  }
  return ok;
}