Program: 139339
Project: 139339
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="String_Node_Str";
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  elementIndics=this.elementToIndicators.values().iterator().next();
  if (elementIndics.isEmpty()) {
    String msg="String_Node_Str" + dataProvider;
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  ConnectionIndicator connectionIndicator=getConnectionIndicator();
  this.resetCounts(connectionIndicator);
  List<TdCatalog> catalogs=DataProviderHelper.getTdCatalogs(dataProvider);
  if (catalogs.isEmpty()) {
    List<TdSchema> schemata=DataProviderHelper.getTdSchema(dataProvider);
    for (    TdSchema tdSchema : schemata) {
      if (!checkSchema(tdSchema.getName())) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdSchema.getName()),false);
        return ok;
      }
    }
    for (    TdSchema tdSchema : schemata) {
      evalSchemaIndic(tdSchema,ok);
    }
  }
 else {
    for (    TdCatalog tdCatalog : catalogs) {
      if (!checkCatalog(tdCatalog.getName())) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdCatalog.getName()),false);
        return ok;
      }
    }
    for (    TdCatalog tdCatalog : catalogs) {
      String catName=tdCatalog.getName();
      try {
        connection.setCatalog(catName);
      }
 catch (      Exception e) {
        log.warn("String_Node_Str" + sqlStatement,e);
      }
      CatalogIndicator catalogIndic=SchemaFactory.eINSTANCE.createCatalogIndicator();
      DefinitionHandler.getInstance().setDefaultIndicatorDefinition(catalogIndic);
      List<TdSchema> schemas=CatalogHelper.getSchemas(tdCatalog);
      if (schemas.isEmpty()) {
        evalCatalogIndic(catalogIndic,tdCatalog,ok);
      }
 else {
        catalogIndic.setAnalyzedElement(tdCatalog);
        for (        TdSchema tdSchema : schemas) {
          SchemaIndicator schemaIndic=SchemaFactory.eINSTANCE.createSchemaIndicator();
          DefinitionHandler.getInstance().setDefaultIndicatorDefinition(schemaIndic);
          evalSchemaIndicLow(catalogIndic,schemaIndic,tdCatalog,tdSchema,ok);
        }
        catalogIndic.setSchemaCount(schemas.size());
      }
    }
  }
  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="String_Node_Str";
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  elementIndics=this.elementToIndicators.values().iterator().next();
  if (elementIndics.isEmpty()) {
    String msg="String_Node_Str" + dataProvider;
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  ConnectionIndicator connectionIndicator=getConnectionIndicator();
  this.resetCounts(connectionIndicator);
  List<TdCatalog> catalogs=DataProviderHelper.getTdCatalogs(dataProvider);
  if (catalogs.isEmpty()) {
    List<TdSchema> schemata=DataProviderHelper.getTdSchema(dataProvider);
    for (    TdSchema tdSchema : schemata) {
      if (!checkSchema(tdSchema)) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdSchema.getName()),false);
        return ok;
      }
    }
    for (    TdSchema tdSchema : schemata) {
      evalSchemaIndic(tdSchema,ok);
    }
  }
 else {
    for (    TdCatalog tdCatalog : catalogs) {
      if (!checkCatalog(tdCatalog.getName())) {
        ok.setReturnCode(Messages.getString("String_Node_Str",tdCatalog.getName()),false);
        return ok;
      }
    }
    for (    TdCatalog tdCatalog : catalogs) {
      String catName=tdCatalog.getName();
      try {
        connection.setCatalog(catName);
      }
 catch (      Exception e) {
        log.warn("String_Node_Str" + sqlStatement,e);
      }
      CatalogIndicator catalogIndic=SchemaFactory.eINSTANCE.createCatalogIndicator();
      DefinitionHandler.getInstance().setDefaultIndicatorDefinition(catalogIndic);
      List<TdSchema> schemas=CatalogHelper.getSchemas(tdCatalog);
      if (schemas.isEmpty()) {
        evalCatalogIndic(catalogIndic,tdCatalog,ok);
      }
 else {
        catalogIndic.setAnalyzedElement(tdCatalog);
        for (        TdSchema tdSchema : schemas) {
          SchemaIndicator schemaIndic=SchemaFactory.eINSTANCE.createSchemaIndicator();
          DefinitionHandler.getInstance().setDefaultIndicatorDefinition(schemaIndic);
          evalSchemaIndicLow(catalogIndic,schemaIndic,tdCatalog,tdSchema,ok);
        }
        catalogIndic.setSchemaCount(schemas.size());
      }
    }
  }
  if (log.isDebugEnabled()) {
    printCounts(connectionIndicator);
  }
  return ok;
}