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

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