Program: 65729
Project: 65729
Buggy source:
private IAggregationResultSet[] populateRs(BirtCubeView view,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper2,StopSign stopSign,boolean saveToRD,IBindingValueFetcher fetcher) throws IOException, BirtException {
  IAggregationResultSet[] rs=null;
  String id=null;
  CubeQueryExecutor executor=view.getCubeQueryExecutor();
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    if (saveToRD || executor.getCubeQueryDefinition().cacheQueryResults())     id=executor.getSession().getQueryResultIDUtil().nextID();
    rs=executeQuery(view,aggrDefns,saveToRD,id,fetcher);
  }
 else {
    id=executor.getCubeQueryDefinition().getQueryResultsID();
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      rs=AggregationResultSetSaveUtil.load(id,new FileArchiveReader(executor.getSession().getTempDir() + "String_Node_Str"),VersionManager.getLatestVersion(),cubeQueryExecutorHelper.getMemoryCacheSize());
      initLoadedAggregationResultSets(rs,aggrDefns);
    }
 else {
      if (executor.getContext().getDocReader() != null) {
        rs=AggregationResultSetSaveUtil.load(executor.getCubeQueryDefinition().getQueryResultsID(),executor.getContext().getDocReader(),new VersionManager(executor.getContext()).getVersion(id),cubeQueryExecutorHelper.getMemoryCacheSize());
        initLoadedAggregationResultSets(rs,aggrDefns);
      }
 else {
        rs=executeQuery(view,aggrDefns,saveToRD,id,fetcher);
      }
    }
  }
  executor.setQueryResultsId(id);
  return rs;
}

Fixed version (ground truth):
private IAggregationResultSet[] populateRs(BirtCubeView view,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper2,StopSign stopSign,boolean saveToRD,IBindingValueFetcher fetcher) throws IOException, BirtException {
  IAggregationResultSet[] rs=null;
  String id=null;
  CubeQueryExecutor executor=view.getCubeQueryExecutor();
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    if (saveToRD || executor.getCubeQueryDefinition().cacheQueryResults())     id=executor.getSession().getQueryResultIDUtil().nextID();
    rs=executeQuery(view,aggrDefns,saveToRD,id,fetcher);
  }
 else {
    id=executor.getCubeQueryDefinition().getQueryResultsID();
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      rs=AggregationResultSetSaveUtil.load(id,new FileArchiveReader(executor.getSession().getTempDir() + "String_Node_Str"),VersionManager.getLatestVersion(),cubeQueryExecutorHelper.getMemoryCacheSize());
      initLoadedAggregationResultSets(rs,aggrDefns);
    }
 else {
      if (executor.getContext().getDocReader() != null && executor.getContext().getMode() != DataEngineContext.MODE_GENERATION) {
        rs=AggregationResultSetSaveUtil.load(executor.getCubeQueryDefinition().getQueryResultsID(),executor.getContext().getDocReader(),new VersionManager(executor.getContext()).getVersion(id),cubeQueryExecutorHelper.getMemoryCacheSize());
        initLoadedAggregationResultSets(rs,aggrDefns);
      }
 else {
        rs=executeQuery(view,aggrDefns,saveToRD,id,fetcher);
      }
    }
  }
  executor.setQueryResultsId(id);
  return rs;
}