Program: 138900
Project: 138900
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());
  }
  NamedColumnSet set=SwitchHelpers.NAMED_COLUMN_SET_SWITCH.doSwitch(indicator.getAnalyzedElement());
  if (set == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  String setName=quote(set.getName());
  if (!belongToSameSchemata(set)) {
    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" + setName + "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(set);
  String catalogName=getQuotedCatalogName(set);
  if (catalogName == null && schemaName != null) {
    final Schema parentSchema=SchemaHelper.getParentSchema(set);
    final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
    catalogName=parentCatalog != null ? parentCatalog.getName() : null;
  }
  if (dbms().getDbmsName().equals(SupportDBUrlType.SYBASEDEFAULTURL.getLanguage())) {
    schemaName=ColumnSetHelper.getTableOwner(set);
  }
  setName=dbms().toQualifiedName(catalogName,schemaName,setName);
  String completedSqlString=null;
  String joinclause=(!joinConditions.isEmpty()) ? dbms().createJoinConditionAsString(set,joinConditions,catalogName,schemaName) : "String_Node_Str";
  completedSqlString=dbms().fillGenericQueryWithJoin(sqlGenericExpression.getBody(),setName,joinclause);
  completedSqlString=addWhereToSqlStringStatement(whereExpression,completedSqlString);
  String finalQuery=completedSqlString;
  TdExpression instantiateSqlExpression=BooleanExpressionHelper.createTdExpression(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());
  }
  NamedColumnSet set=SwitchHelpers.NAMED_COLUMN_SET_SWITCH.doSwitch(indicator.getAnalyzedElement());
  if (set == null) {
    return traceError("String_Node_Str" + indicator.getName());
  }
  String setName=quote(set.getName());
  if (!belongToSameSchemata(set)) {
    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" + setName + "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(set);
  String catalogName=getQuotedCatalogName(set);
  if (catalogName == null && schemaName != null) {
    final Schema parentSchema=SchemaHelper.getParentSchema(set);
    final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
    catalogName=parentCatalog != null ? parentCatalog.getName() : null;
  }
  if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
    schemaName=ColumnSetHelper.getTableOwner(set);
  }
  setName=dbms().toQualifiedName(catalogName,schemaName,setName);
  String completedSqlString=null;
  String joinclause=(!joinConditions.isEmpty()) ? dbms().createJoinConditionAsString(set,joinConditions,catalogName,schemaName) : "String_Node_Str";
  completedSqlString=dbms().fillGenericQueryWithJoin(sqlGenericExpression.getBody(),setName,joinclause);
  completedSqlString=addWhereToSqlStringStatement(whereExpression,completedSqlString);
  String finalQuery=completedSqlString;
  TdExpression instantiateSqlExpression=BooleanExpressionHelper.createTdExpression(language,finalQuery);
  indicator.setInstantiatedExpression(instantiateSqlExpression);
  return true;
}