Program: 69654
Project: 69654
Buggy source:
/** 
 * @return
 */
private QueryDefinition newGenIVReportQuery(){
  QueryDefinition qd=newReportQuery();
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  for (int i=0; i < rowBeArray.length; i++)   qd.addResultSetExpression(this.rowExprName[i],rowBeArray[i]);
  if (this.GEN_use_invalid_column)   qd.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  if (!this.notIncludeAggr) {
    for (int i=0; i < totalBeArray.length; i++)     qd.addResultSetExpression(this.totalExprName[i],totalBeArray[i]);
  }
  if (this.GEN_add_filter == true) {
    ConditionalExpression filterExpr=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
    FilterDefinition filterDefn=new FilterDefinition(filterExpr);
    qd.addFilter(filterDefn);
    this.GEN_filterDefn.add(filterDefn);
  }
  if (this.TEST_ISEMPTY) {
    ConditionalExpression filterExpr=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
    FilterDefinition filterDefn=new FilterDefinition(filterExpr);
    qd.addFilter(filterDefn);
    this.GEN_filterDefn.add(filterDefn);
  }
  if (this.GEN_add_sort) {
    SortDefinition sortDefn=new SortDefinition();
    sortDefn.setColumn("String_Node_Str");
    qd.addSort(sortDefn);
  }
  if (this.GEN_add_group == true) {
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
    if (this.GEN_add_subquery == true) {
      SubqueryDefinition subqueryDefn=getSubQueryDefn(qd);
      gd.addSubquery(subqueryDefn);
    }
  }
  if (this.GEN_add_group1 == true) {
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
    gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
  }
  if (add_subquery_on_query) {
    qd.addSubquery(getSubQueryDefn(qd));
  }
  return qd;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException 
 */
private QueryDefinition newGenIVReportQuery() throws DataException {
  QueryDefinition qd=newReportQuery();
  IBaseExpression[] rowBeArray=getRowExpr();
  IBinding[] totalBeArray=getAggrExpr();
  for (int i=0; i < rowBeArray.length; i++)   qd.addResultSetExpression(this.rowExprName[i],rowBeArray[i]);
  if (this.GEN_use_invalid_column)   qd.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  if (!this.notIncludeAggr) {
    for (int i=0; i < totalBeArray.length; i++)     qd.addBinding(totalBeArray[i]);
  }
  if (this.GEN_add_filter == true) {
    ConditionalExpression filterExpr=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
    FilterDefinition filterDefn=new FilterDefinition(filterExpr);
    qd.addFilter(filterDefn);
    this.GEN_filterDefn.add(filterDefn);
  }
  if (this.TEST_ISEMPTY) {
    ConditionalExpression filterExpr=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
    FilterDefinition filterDefn=new FilterDefinition(filterExpr);
    qd.addFilter(filterDefn);
    this.GEN_filterDefn.add(filterDefn);
  }
  if (this.GEN_add_sort) {
    SortDefinition sortDefn=new SortDefinition();
    sortDefn.setColumn("String_Node_Str");
    qd.addSort(sortDefn);
  }
  if (this.GEN_add_group == true) {
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
    if (this.GEN_add_subquery == true) {
      SubqueryDefinition subqueryDefn=getSubQueryDefn(qd);
      gd.addSubquery(subqueryDefn);
    }
  }
  if (this.GEN_add_group1 == true) {
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
    gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addGroup(gd);
  }
  if (add_subquery_on_query) {
    qd.addSubquery(getSubQueryDefn(qd));
  }
  return qd;
}