Program: 69630
Project: 69630
Buggy source:
/** 
 * @throws BirtException
 */
private void genSubOfSubQuery() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  queryDefn.addGroup(groupDefn);
  queryDefn.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  groupDefn.addSubquery(subQueryDefn);
  GroupDefinition subGroupDefn=new GroupDefinition();
  subGroupDefn.setKeyColumn("String_Node_Str");
  subQueryDefn.addGroup(subGroupDefn);
  subQueryDefn.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  SubqueryDefinition subOfSubQueryDefn=new SubqueryDefinition(subOfSubQueryName,subQueryDefn);
  subGroupDefn.addSubquery(subOfSubQueryDefn);
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(rowExprName,rowBeArray,totalExprName,totalBeArray,subOfSubQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(subScope);
  saveForPresentation(qr,rowBeArray,totalBeArray);
  IResultIterator ri=qr.getResultIterator();
  ri.next();
  IResultIterator ri2=ri.getSecondaryIterator(subQueryName,scope);
  ri2.next();
  IResultIterator ri3=ri2.getSecondaryIterator(subOfSubQueryName,subOfSubScope);
  while (ri3.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri3.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri3.getValue(totalExprName[i]));
  }
  ri3.close();
  ri2.close();
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 */
private void genSubOfSubQuery() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  queryDefn.addGroup(groupDefn);
  queryDefn.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  groupDefn.addSubquery(subQueryDefn);
  GroupDefinition subGroupDefn=new GroupDefinition();
  subGroupDefn.setKeyColumn("String_Node_Str");
  subQueryDefn.addGroup(subGroupDefn);
  subQueryDefn.addResultSetExpression("String_Node_Str",new ScriptExpression("String_Node_Str"));
  SubqueryDefinition subOfSubQueryDefn=new SubqueryDefinition(subOfSubQueryName,subQueryDefn);
  subGroupDefn.addSubquery(subOfSubQueryDefn);
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(subOfSubQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(subScope);
  saveForPresentation(qr);
  IResultIterator ri=qr.getResultIterator();
  ri.next();
  IResultIterator ri2=ri.getSecondaryIterator(subQueryName,scope);
  ri2.next();
  IResultIterator ri3=ri2.getSecondaryIterator(subOfSubQueryName,subOfSubScope);
  while (ri3.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri3.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri3.getValue(totalExprName[i]));
  }
  ri3.close();
  ri2.close();
  qr.close();
  myGenDataEngine.shutdown();
}