Program: 74074
Project: 74074
Buggy source:
/** 
 * Test grand total
 * @throws Exception
 */
public void testGrandTotalCache() 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");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IBinding binding1=new Binding("String_Node_Str");
  binding1.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding1);
  IBinding binding2=new Binding("String_Node_Str");
  binding2.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding2);
  IBinding binding4=new Binding("String_Node_Str");
  binding4.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding4);
  IBinding binding5=new Binding("String_Node_Str");
  binding5.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding5);
  IBinding binding6=new Binding("String_Node_Str");
  binding6.setExpression(new ScriptExpression("String_Node_Str"));
  binding6.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  binding6.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding6);
  IBinding binding7=new Binding("String_Node_Str");
  binding7.setExpression(new ScriptExpression("String_Node_Str"));
  binding7.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  binding7.addAggregateOn("String_Node_Str");
  binding7.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding7);
  IBinding binding8=new Binding("String_Node_Str");
  binding8.setExpression(new ScriptExpression("String_Node_Str"));
  binding8.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  cqd.addBinding(binding8);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  sorter1.setTargetLevel(level21);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  sorter2.setTargetLevel(level11);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  sorter3.setTargetLevel(level12);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  cqd.setCacheQueryResults(true);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  this.printCube(cursor,columnEdgeBindingNames,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test grand total
 * @throws Exception
 */
public void testGrandTotalCache() 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");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IBinding binding1=new Binding("String_Node_Str");
  binding1.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding1);
  IBinding binding2=new Binding("String_Node_Str");
  binding2.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding2);
  IBinding binding4=new Binding("String_Node_Str");
  binding4.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding4);
  IBinding binding5=new Binding("String_Node_Str");
  binding5.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding5);
  IBinding binding6=new Binding("String_Node_Str");
  binding6.setExpression(new ScriptExpression("String_Node_Str"));
  binding6.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  binding6.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding6);
  IBinding binding7=new Binding("String_Node_Str");
  binding7.setExpression(new ScriptExpression("String_Node_Str"));
  binding7.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  binding7.addAggregateOn("String_Node_Str");
  binding7.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding7);
  IBinding binding8=new Binding("String_Node_Str");
  binding8.setExpression(new ScriptExpression("String_Node_Str"));
  binding8.setAggrFunction(IBuildInAggregation.TOTAL_SUM_FUNC);
  cqd.addBinding(binding8);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  sorter1.setTargetLevel(level21);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  sorter2.setTargetLevel(level11);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  sorter3.setTargetLevel(level12);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  cqd.setCacheQueryResults(true);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  this.printCube(cursor,columnEdgeBindingNames,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}