Program: 64895
Project: 64895
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());
      if (view.getCubeQueryExecutionHints() == null) {
        CubeQueryExecutorHints hints=new CubeQueryExecutorHints();
        view.getCubeQueryExecutionHints().executeCubeOperation(false);
      }
      QueryExecutorUtil.initLoadedAggregationResultSets(rs,getSavedAggregations());
    }
 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());
        if (view.getCubeQueryExecutionHints() == null) {
          CubeQueryExecutorHints hints=new CubeQueryExecutorHints();
          view.getCubeQueryExecutionHints().executeCubeOperation(false);
        }
        QueryExecutorUtil.initLoadedAggregationResultSets(rs,getSavedAggregations());
      }
 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()) {
      FileArchiveReader far=new FileArchiveReader(executor.getSession().getTempDir() + "String_Node_Str");
      rs=AggregationResultSetSaveUtil.load(id,far,VersionManager.getLatestVersion(),cubeQueryExecutorHelper.getMemoryCacheSize());
      far.close();
      if (view.getCubeQueryExecutionHints() == null) {
        CubeQueryExecutorHints hints=new CubeQueryExecutorHints();
        view.getCubeQueryExecutionHints().executeCubeOperation(false);
      }
      QueryExecutorUtil.initLoadedAggregationResultSets(rs,getSavedAggregations());
    }
 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());
        if (view.getCubeQueryExecutionHints() == null) {
          CubeQueryExecutorHints hints=new CubeQueryExecutorHints();
          view.getCubeQueryExecutionHints().executeCubeOperation(false);
        }
        QueryExecutorUtil.initLoadedAggregationResultSets(rs,getSavedAggregations());
      }
 else {
        rs=executeQuery(view,aggrDefns,saveToRD,id,fetcher);
      }
    }
  }
  executor.setQueryResultsId(id);
  return rs;
}