Program: 137729
Project: 137729
Buggy source:
/** 
 * get Query For User define indicator.
 * @param indicatorDefinition
 * @return
 */
private String getQueryForUDIndicator(IndicatorDefinition indicatorDefinition){
  String sql=PluginConstant.EMPTY_STRING;
  EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewRowsExpression();
  TdExpression tdExp=DbmsLanguage.getSqlExpression(indicatorDefinition,dbmsLanguage.getDbmsName(),list,dbmsLanguage.getDbVersion());
  sql=tdExp.getBody();
  String dataFilterClause=getDataFilterClause();
  if (!dataFilterClause.equals(PluginConstant.EMPTY_STRING)) {
    sql=sql.replace(GenericSQLHandler.WHERE_CLAUSE,dbmsLanguage.where() + dataFilterClause);
    sql=sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE,dbmsLanguage.and() + dataFilterClause);
  }
 else {
    sql=sql.replace(GenericSQLHandler.WHERE_CLAUSE,PluginConstant.EMPTY_STRING);
    sql=sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE,PluginConstant.EMPTY_STRING);
  }
  ModelElement analyzedElement=this.indicator.getAnalyzedElement();
  String tableName=getFullyQualifiedTableName(analyzedElement);
  sql=sql.replace(GenericSQLHandler.TABLE_NAME,tableName);
  sql=sql.replace(GenericSQLHandler.COLUMN_NAMES,analyzedElement.getName());
  if (sql.indexOf(GenericSQLHandler.UDI_INDICATOR_VALUE) != -1) {
    sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,"String_Node_Str" + entity.getKey() + "String_Node_Str");
  }
  if (sql.indexOf(GenericSQLHandler.GROUP_BY_ALIAS) != -1) {
    sql=sql.replace(GenericSQLHandler.GROUP_BY_ALIAS,"String_Node_Str" + analyzedElement.getName() + "String_Node_Str");
  }
  return sql;
}

Fixed version (ground truth):
/** 
 * get Query For User define indicator.
 * @param indicatorDefinition
 * @return
 */
private String getQueryForUDIndicator(IndicatorDefinition indicatorDefinition){
  String sql=PluginConstant.EMPTY_STRING;
  EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewRowsExpression();
  TdExpression tdExp=DbmsLanguage.getSqlExpression(indicatorDefinition,dbmsLanguage.getDbmsName(),list,dbmsLanguage.getDbVersion());
  sql=tdExp.getBody();
  String dataFilterClause=getDataFilterClause();
  if (!dataFilterClause.equals(PluginConstant.EMPTY_STRING)) {
    sql=sql.replace(GenericSQLHandler.WHERE_CLAUSE,dbmsLanguage.where() + "String_Node_Str" + dataFilterClause+ "String_Node_Str");
    sql=sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE,dbmsLanguage.and() + "String_Node_Str" + dataFilterClause+ "String_Node_Str");
  }
 else {
    sql=sql.replace(GenericSQLHandler.WHERE_CLAUSE,PluginConstant.EMPTY_STRING);
    sql=sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE,PluginConstant.EMPTY_STRING);
  }
  ModelElement analyzedElement=this.indicator.getAnalyzedElement();
  String tableName=getFullyQualifiedTableName(analyzedElement);
  sql=sql.replace(GenericSQLHandler.TABLE_NAME,tableName);
  sql=sql.replace(GenericSQLHandler.COLUMN_NAMES,analyzedElement.getName());
  if (sql.indexOf(GenericSQLHandler.UDI_INDICATOR_VALUE) != -1) {
    Object key=entity.getKey();
    if (key == null) {
      sql=sql.replace("String_Node_Str" + GenericSQLHandler.UDI_INDICATOR_VALUE,"String_Node_Str");
    }
 else {
      sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,"String_Node_Str" + key + "String_Node_Str");
    }
  }
  if (sql.indexOf(GenericSQLHandler.GROUP_BY_ALIAS) != -1) {
    sql=sql.replace(GenericSQLHandler.GROUP_BY_ALIAS,"String_Node_Str" + analyzedElement.getName() + "String_Node_Str");
  }
  return sql;
}