Program: 140277
Project: 140277
Buggy source:
/** 
 * DOC scorreia Comment method "getDateAggregatedCompletedString".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param dataFilterExpression
 * @param dateAggregationType
 * @return
 */
@SuppressWarnings("String_Node_Str") private String getDateAggregatedCompletedString(Expression sqlExpression,String colName,String table,DateGrain dateAggregationType){
  int nbExtractedColumns=0;
  String result="String_Node_Str";
  String aliases="String_Node_Str";
  String alias;
switch (dateAggregationType) {
case DAY:
    alias=getAlias(colName,DateGrain.DAY);
  result=dbms().extractDay(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case WEEK:
alias=getAlias(colName,DateGrain.WEEK);
result=dbms().extractWeek(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case MONTH:
alias=getAlias(colName,DateGrain.MONTH);
result=dbms().extractMonth(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case QUARTER:
alias=getAlias(colName,DateGrain.QUARTER);
result=dbms().extractQuarter(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case YEAR:
alias=getAlias(colName,DateGrain.YEAR);
result=dbms().extractYear(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
break;
case NONE:
result=colName;
nbExtractedColumns++;
break;
default :
break;
}
String sql=replaceVariablesLow(sqlExpression.getBody(),result,table,aliases);
return sql;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getDateAggregatedCompletedString".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param dataFilterExpression
 * @param dateAggregationType
 * @return
 */
@SuppressWarnings("String_Node_Str") private String getDateAggregatedCompletedString(Expression sqlExpression,String colName,String table,DateGrain dateAggregationType){
  int nbExtractedColumns=0;
  String result="String_Node_Str";
  String aliases="String_Node_Str";
  String alias;
switch (dateAggregationType) {
case DAY:
    alias=getAlias(colName,DateGrain.DAY);
  result=dbms().extractDay(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case WEEK:
alias=getAlias(colName,DateGrain.WEEK);
result=dbms().extractWeek(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case MONTH:
alias=getAlias(colName,DateGrain.MONTH);
result=dbms().extractMonth(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case QUARTER:
alias=getAlias(colName,DateGrain.QUARTER);
result=dbms().extractQuarter(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
case YEAR:
alias=getAlias(colName,DateGrain.YEAR);
result=dbms().extractYear(colName) + alias + comma(result);
aliases=alias + comma(aliases);
nbExtractedColumns++;
break;
case NONE:
result=colName;
nbExtractedColumns++;
break;
default :
break;
}
String groupByAliases=dbms().supportAliasesInGroupBy() ? aliases : result;
String sql=replaceVariablesLow(sqlExpression.getBody(),result,table,groupByAliases);
return sql;
}