Program: 74081
Project: 74081
Buggy source:
/** 
 * Test Nested total
 * @throws Exception
 */
public void testNestedCrossTab() 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);
  CubeFilterDefinition filter1=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter1.setAxisQualifierLevels(null);
  filter1.setAxisQualifierValues(null);
  filter1.setTargetLevel(level21);
  CubeFilterDefinition filter2=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter2.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  filter2.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  filter2.setTargetLevel(level12);
  CubeFilterDefinition filter3=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter3.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  filter3.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  filter3.setTargetLevel(level11);
  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.addFilter(filter1);
  cqd.addFilter(filter2);
  cqd.addFilter(filter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  this.defineDataSourceDataSet(engine);
  IQueryDefinition query=this.createScriptDataSetQuery();
  IPreparedQuery pq=engine.prepare(query);
  IQueryResults queryResults=pq.execute(null);
  IResultIterator it=queryResults.getResultIterator();
  while (it.next()) {
    if ("String_Node_Str".equals(it.getValue("String_Node_Str").toString()) || "String_Node_Str".equals(it.getValue("String_Node_Str").toString())) {
      this.testPrintln("String_Node_Str" + it.getValue("String_Node_Str").toString());
      IPreparedCubeQuery pcq=engine.prepare(cqd,null);
      ICubeQueryResults cqResults=(ICubeQueryResults)pcq.execute(queryResults,null);
      CubeCursor cursor=cqResults.getCubeCursor();
      List columnEdgeBindingNames=new ArrayList();
      columnEdgeBindingNames.add("String_Node_Str");
      columnEdgeBindingNames.add("String_Node_Str");
      columnEdgeBindingNames.add("String_Node_Str");
      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.checkOutputFile();
}

Fixed version (ground truth):
/** 
 * Test Nested total
 * @throws Exception
 */
public void testNestedCrossTab() 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);
  CubeFilterDefinition filter1=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter1.setAxisQualifierLevels(null);
  filter1.setAxisQualifierValues(null);
  filter1.setTargetLevel(level21);
  CubeFilterDefinition filter2=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter2.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  filter2.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  filter2.setTargetLevel(level12);
  CubeFilterDefinition filter3=new CubeFilterDefinition(new ScriptExpression("String_Node_Str"));
  filter3.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  filter3.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  filter3.setTargetLevel(level11);
  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.addFilter(filter1);
  cqd.addFilter(filter2);
  cqd.addFilter(filter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  this.defineDataSourceDataSet(engine);
  IQueryDefinition query=this.createScriptDataSetQuery();
  IPreparedQuery pq=engine.prepare(query);
  IQueryResults queryResults=pq.execute(null);
  IResultIterator it=queryResults.getResultIterator();
  while (it.next()) {
    if ("String_Node_Str".equals(it.getValue("String_Node_Str").toString()) || "String_Node_Str".equals(it.getValue("String_Node_Str").toString())) {
      this.testPrintln("String_Node_Str" + it.getValue("String_Node_Str").toString());
      IPreparedCubeQuery pcq=engine.prepare(cqd,null);
      ICubeQueryResults cqResults=(ICubeQueryResults)pcq.execute(queryResults,null);
      CubeCursor cursor=cqResults.getCubeCursor();
      List columnEdgeBindingNames=new ArrayList();
      columnEdgeBindingNames.add("String_Node_Str");
      columnEdgeBindingNames.add("String_Node_Str");
      columnEdgeBindingNames.add("String_Node_Str");
      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.checkOutputFile();
}