Program: 66970
Project: 66970
Buggy source:
private IAggregationResultSet[] populateRs(BirtCubeView view,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper2,StopSign stopSign,boolean saveToRD) throws IOException, BirtException {
  IAggregationResultSet[] rs;
  String id=null;
  CubeQueryExecutor executor=view.getCubeQueryExecutor();
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    rs=cubeQueryExecutorHelper.execute(aggrDefns,executor.getSession().getStopSign());
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      id=executor.getSession().getQueryResultIDUtil().nextID();
      File tmpDir=new File(executor.getSession().getTempDir());
      if (!FileSecurity.fileExist(tmpDir) || !FileSecurity.fileIsDirectory(tmpDir)) {
        FileSecurity.fileMakeDirs(tmpDir);
      }
      ArchiveWriter writer=new ArchiveWriter(new ArchiveFile(executor.getSession().getTempDir() + "String_Node_Str","String_Node_Str"));
      AggregationResultSetSaveUtil.save(id,rs,writer);
      writer.finish();
    }
    if (saveToRD) {
      if (id != null) {
        CubeQueryDefinitionIOUtil.save(id,executor.getContext().getDocWriter(),executor.getCubeQueryDefinition());
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
 else {
        id=executor.getSession().getQueryResultIDUtil().nextID();
        CubeQueryDefinitionIOUtil.save(id,executor.getContext().getDocWriter(),executor.getCubeQueryDefinition());
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
    }
  }
 else {
    id=executor.getCubeQueryDefinition().getQueryResultsID();
    rs=AggregationResultSetSaveUtil.load(id,new FileArchiveReader(executor.getSession().getTempDir() + "String_Node_Str"),VersionManager.getLatestVersion());
    initLoadedAggregationResultSets(rs,aggrDefns);
  }
  executor.setQueryResultsId(id);
  return rs;
}

Fixed version (ground truth):
private IAggregationResultSet[] populateRs(BirtCubeView view,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper2,StopSign stopSign,boolean saveToRD) throws IOException, BirtException {
  IAggregationResultSet[] rs;
  String id=null;
  CubeQueryExecutor executor=view.getCubeQueryExecutor();
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    rs=cubeQueryExecutorHelper.execute(aggrDefns,executor.getSession().getStopSign());
    MirrorOperationExecutor moe=new MirrorOperationExecutor();
    rs=moe.execute(rs,view,cubeQueryExecutorHelper);
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      id=executor.getSession().getQueryResultIDUtil().nextID();
      File tmpDir=new File(executor.getSession().getTempDir());
      if (!FileSecurity.fileExist(tmpDir) || !FileSecurity.fileIsDirectory(tmpDir)) {
        FileSecurity.fileMakeDirs(tmpDir);
      }
      ArchiveWriter writer=new ArchiveWriter(new ArchiveFile(executor.getSession().getTempDir() + "String_Node_Str","String_Node_Str"));
      AggregationResultSetSaveUtil.save(id,rs,writer);
      writer.finish();
    }
    if (saveToRD) {
      if (id != null) {
        CubeQueryDefinitionIOUtil.save(id,executor.getContext().getDocWriter(),executor.getCubeQueryDefinition());
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
 else {
        id=executor.getSession().getQueryResultIDUtil().nextID();
        CubeQueryDefinitionIOUtil.save(id,executor.getContext().getDocWriter(),executor.getCubeQueryDefinition());
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
    }
  }
 else {
    id=executor.getCubeQueryDefinition().getQueryResultsID();
    rs=AggregationResultSetSaveUtil.load(id,new FileArchiveReader(executor.getSession().getTempDir() + "String_Node_Str"),VersionManager.getLatestVersion());
    initLoadedAggregationResultSets(rs,aggrDefns);
  }
  executor.setQueryResultsId(id);
  return rs;
}