Program: 139711
Project: 139711
Buggy source:
private boolean createSqlQuery(String dataFilterAsString,Indicator indicator) throws ParseException, AnalysisExecutionException {
  ModelElement analyzedElement=indicator.getAnalyzedElement();
  if (analyzedElement == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  TdTable tdTable=SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement());
  if (tdTable == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  String tableName=quote(tdTable.getName());
  if (!belongToSameSchemata(tdTable)) {
    StringBuffer buf=new StringBuffer();
    for (    orgomg.cwm.objectmodel.core.Package schema : schemata.values()) {
      buf.append(schema.getName() + "String_Node_Str");
    }
    log.error("String_Node_Str" + tableName + "String_Node_Str"+ buf.toString().trim()+ "String_Node_Str");
    return false;
  }
  String language=dbms().getDbmsName();
  Expression sqlGenericExpression=null;
  IndicatorDefinition indicatorDefinition=indicator.getIndicatorDefinition();
  if (indicatorDefinition == null) {
    return traceError("String_Node_Str" + indicator.getName() + "String_Node_Str");
  }
  sqlGenericExpression=dbms().getSqlExpression(indicatorDefinition);
  final EClass indicatorEclass=indicator.eClass();
  if (sqlGenericExpression == null || sqlGenericExpression.getBody() == null) {
    return traceError("String_Node_Str" + (indicator.getName() != null ? indicator.getName() : indicatorEclass.getName()) + "String_Node_Str"+ ResourceHelper.getUUID(indicatorDefinition)+ "String_Node_Str");
  }
  List<String> whereExpression=new ArrayList<String>();
  if (StringUtils.isNotBlank(dataFilterAsString)) {
    whereExpression.add(dataFilterAsString);
  }
  final EList<JoinElement> joinConditions=indicator.getJoinConditions();
  if (RulesPackage.eINSTANCE.getWhereRule().equals(indicatorDefinition.eClass())) {
    WhereRule wr=(WhereRule)indicatorDefinition;
    whereExpression.add(wr.getWhereExpression());
    joinConditions.clear();
    if (!wr.getJoins().isEmpty()) {
      for (      JoinElement joinelt : wr.getJoins()) {
        JoinElement joinCopy=(JoinElement)EcoreUtil.copy(joinelt);
        joinConditions.add(joinCopy);
      }
    }
  }
  IndicatorParameters parameters=indicator.getParameters();
  if (parameters != null) {
  }
  String schemaName=getQuotedSchemaName(tdTable);
  String catalogName=getQuotedCatalogName(tdTable);
  if (catalogName == null && schemaName != null) {
    final TdSchema parentSchema=SchemaHelper.getParentSchema(tdTable);
    final TdCatalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
    catalogName=parentCatalog != null ? parentCatalog.getName() : null;
  }
  tableName=dbms().toQualifiedName(catalogName,schemaName,tableName);
  String completedSqlString=null;
  String joinclause=(!joinConditions.isEmpty()) ? dbms().createJoinConditionAsString(joinConditions) : "String_Node_Str";
  completedSqlString=dbms().fillGenericQueryWithJoin(sqlGenericExpression.getBody(),tableName,joinclause);
  completedSqlString=addWhereToSqlStringStatement(whereExpression,completedSqlString);
  String finalQuery=completedSqlString;
  Expression instantiateSqlExpression=BooleanExpressionHelper.createExpression(language,finalQuery);
  indicator.setInstantiatedExpression(instantiateSqlExpression);
  return true;
}

Fixed version (ground truth):
private boolean createSqlQuery(String dataFilterAsString,Indicator indicator) throws ParseException, AnalysisExecutionException {
  ModelElement analyzedElement=indicator.getAnalyzedElement();
  if (analyzedElement == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  TdTable tdTable=SwitchHelpers.TABLE_SWITCH.doSwitch(indicator.getAnalyzedElement());
  if (tdTable == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  String tableName=quote(tdTable.getName());
  if (!belongToSameSchemata(tdTable)) {
    StringBuffer buf=new StringBuffer();
    for (    orgomg.cwm.objectmodel.core.Package schema : schemata.values()) {
      buf.append(schema.getName() + "String_Node_Str");
    }
    log.error("String_Node_Str" + tableName + "String_Node_Str"+ buf.toString().trim()+ "String_Node_Str");
    return false;
  }
  String language=dbms().getDbmsName();
  Expression sqlGenericExpression=null;
  IndicatorDefinition indicatorDefinition=indicator.getIndicatorDefinition();
  if (indicatorDefinition == null) {
    return traceError("String_Node_Str" + indicator.getName() + "String_Node_Str");
  }
  sqlGenericExpression=dbms().getSqlExpression(indicatorDefinition);
  final EClass indicatorEclass=indicator.eClass();
  if (sqlGenericExpression == null || sqlGenericExpression.getBody() == null) {
    return traceError("String_Node_Str" + (indicator.getName() != null ? indicator.getName() : indicatorEclass.getName()) + "String_Node_Str"+ ResourceHelper.getUUID(indicatorDefinition)+ "String_Node_Str");
  }
  List<String> whereExpression=new ArrayList<String>();
  if (StringUtils.isNotBlank(dataFilterAsString)) {
    whereExpression.add(dataFilterAsString);
  }
  final EList<JoinElement> joinConditions=indicator.getJoinConditions();
  if (RulesPackage.eINSTANCE.getWhereRule().equals(indicatorDefinition.eClass())) {
    WhereRule wr=(WhereRule)indicatorDefinition;
    whereExpression.add(wr.getWhereExpression());
    joinConditions.clear();
    if (!wr.getJoins().isEmpty()) {
      for (      JoinElement joinelt : wr.getJoins()) {
        JoinElement joinCopy=(JoinElement)EcoreUtil.copy(joinelt);
        joinConditions.add(joinCopy);
      }
    }
  }
  IndicatorParameters parameters=indicator.getParameters();
  if (parameters != null) {
  }
  String schemaName=getQuotedSchemaName(tdTable);
  String catalogName=getQuotedCatalogName(tdTable);
  if (catalogName == null && schemaName != null) {
    final TdSchema parentSchema=SchemaHelper.getParentSchema(tdTable);
    final TdCatalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
    catalogName=parentCatalog != null ? parentCatalog.getName() : null;
  }
  tableName=dbms().toQualifiedName(catalogName,schemaName,tableName);
  String completedSqlString=null;
  String joinclause=(!joinConditions.isEmpty()) ? dbms().createJoinConditionAsString(tdTable,joinConditions) : "String_Node_Str";
  completedSqlString=dbms().fillGenericQueryWithJoin(sqlGenericExpression.getBody(),tableName,joinclause);
  completedSqlString=addWhereToSqlStringStatement(whereExpression,completedSqlString);
  String finalQuery=completedSqlString;
  Expression instantiateSqlExpression=BooleanExpressionHelper.createExpression(language,finalQuery);
  indicator.setInstantiatedExpression(instantiateSqlExpression);
  return true;
}