Program: 74114
Project: 74114
Buggy source:
/** 
 * Test crosstab + crosstab
 * @throws Exception
 */
public void testNestedCrossTab2() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  ILevelDefinition level13=hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevels(null);
  sorter4.setAxisQualifierValues(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevels(null);
  sorter5.setAxisQualifierValues(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults cqResults=pcq.execute(null);
  CubeCursor outerCursor=cqResults.getCubeCursor();
  CubeFilterDefinition filter1=new CubeFilterDefinition(new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_EQ,"String_Node_Str"));
  filter1.setTargetLevel(level13);
  cqd.addFilter(filter1);
  IBinding out=new Binding("String_Node_Str");
  out.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(out);
  int depth=0;
  EdgeCursor edge1=(EdgeCursor)(outerCursor.getOrdinateEdge().get(0));
  EdgeCursor edge2=(EdgeCursor)(outerCursor.getOrdinateEdge().get(1));
  edge1.beforeFirst();
  while (edge2.next()) {
    if (depth > 5)     break;
    edge1.beforeFirst();
    while (edge1.next()) {
      depth++;
      if (depth > 5)       break;
      this.testPrintln("String_Node_Str" + outerCursor.getObject("String_Node_Str").toString());
      IPreparedCubeQuery pcq1=engine.prepare(cqd,null);
      ICubeQueryResults cqResults1=(ICubeQueryResults)pcq1.execute(cqResults,null);
      CubeCursor cursor=cqResults1.getCubeCursor();
      printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str",false);
      this.testPrintln("String_Node_Str" + cursor.getObject("String_Node_Str"));
    }
  }
  this.checkOutputFile();
}

Fixed version (ground truth):
/** 
 * Test crosstab + crosstab
 * @throws Exception
 */
public void testNestedCrossTab2() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  ILevelDefinition level13=hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevels(null);
  sorter4.setAxisQualifierValues(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevels(null);
  sorter5.setAxisQualifierValues(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults cqResults=pcq.execute(null);
  CubeCursor outerCursor=cqResults.getCubeCursor();
  CubeFilterDefinition filter1=new CubeFilterDefinition(new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_EQ,"String_Node_Str"));
  filter1.setTargetLevel(level13);
  cqd.addFilter(filter1);
  IBinding out=new Binding("String_Node_Str");
  out.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(out);
  int depth=0;
  EdgeCursor edge1=(EdgeCursor)(outerCursor.getOrdinateEdge().get(0));
  EdgeCursor edge2=(EdgeCursor)(outerCursor.getOrdinateEdge().get(1));
  edge1.beforeFirst();
  while (edge2.next()) {
    if (depth > 5)     break;
    edge1.beforeFirst();
    while (edge1.next()) {
      depth++;
      if (depth > 5)       break;
      this.testPrintln("String_Node_Str" + outerCursor.getObject("String_Node_Str").toString());
      IPreparedCubeQuery pcq1=engine.prepare(cqd,null);
      ICubeQueryResults cqResults1=(ICubeQueryResults)pcq1.execute(cqResults,null);
      CubeCursor cursor=cqResults1.getCubeCursor();
      printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str",false);
      this.testPrintln("String_Node_Str" + cursor.getObject("String_Node_Str"));
    }
  }
  this.checkOutputFile();
}