Program: 137731
Project: 137731
Buggy source:
/** 
 * get Query For View Rows.
 * @param indicatorDefinition
 * @return
 */
private String getQueryForViewRows(IndicatorDefinition indicatorDefinition){
  String sql=PluginConstant.EMPTY_STRING;
  IndicatorCategory category=IndicatorCategoryHelper.getCategory(indicatorDefinition);
  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);
  }
  String tableName=getFullyQualifiedTableName(this.indicator.getAnalyzedElement());
  sql=sql.replace(GenericSQLHandler.TABLE_NAME,tableName);
  sql=sql.replace(GenericSQLHandler.COLUMN_NAMES,this.indicator.getAnalyzedElement().getName());
  if (sql.indexOf(GenericSQLHandler.UDI_INDICATOR_VALUE) != -1) {
    if (IndicatorCategoryHelper.isUserDefRealValue(category)) {
      sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,this.indicator.getRealValue().toString());
    }
 else {
      sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,(String.valueOf(this.indicator.getIntegerValue().intValue())));
    }
  }
  return sql;
}

Fixed version (ground truth):
/** 
 * get Query For View Rows.
 * @param indicatorDefinition
 * @return
 */
private String getQueryForViewRows(IndicatorDefinition indicatorDefinition){
  String sql=PluginConstant.EMPTY_STRING;
  IndicatorCategory category=IndicatorCategoryHelper.getCategory(indicatorDefinition);
  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);
  }
  String tableName=getFullyQualifiedTableName(this.indicator.getAnalyzedElement());
  sql=sql.replace(GenericSQLHandler.TABLE_NAME,tableName);
  sql=sql.replace(GenericSQLHandler.COLUMN_NAMES,this.indicator.getAnalyzedElement().getName());
  if (sql.indexOf(GenericSQLHandler.UDI_INDICATOR_VALUE) != -1) {
    if (IndicatorCategoryHelper.isUserDefRealValue(category)) {
      sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,this.indicator.getRealValue().toString());
    }
 else {
      sql=sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE,(String.valueOf(this.indicator.getIntegerValue().intValue())));
    }
  }
  return sql;
}