Program: 73973
Project: 73973
Buggy source:
/** 
 * Populate the Result Set, either by re-execution ( If it has not been executed yet ) or  get it from local time folder.
 * @param executor
 * @param aggrDefns
 * @param cubeQueryExcutorHelper
 * @return
 * @throws IOException
 * @throws BirtException
 */
private IAggregationResultSet[] populateRs(CubeQueryExecutor executor,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper,boolean saveToRD) throws IOException, BirtException {
  IAggregationResultSet[] rs;
  String id=null;
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    rs=cubeQueryExcutorHelper.execute(aggrDefns,new StopSign());
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      id=QueryResultIDUtil.nextID();
      FileArchiveWriter writer=new FileArchiveWriter(executor.getSession().getTempDir() + "String_Node_Str");
      AggregationResultSetSaveUtil.save(id,rs,writer);
      writer.finish();
    }
    if (saveToRD) {
      if (id != null) {
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
 else {
        id=QueryResultIDUtil.nextID();
        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());
  }
  executor.setQueryResultsId(id);
  return rs;
}

Fixed version (ground truth):
/** 
 * Populate the Result Set, either by re-execution ( If it has not been executed yet ) or  get it from local time folder.
 * @param executor
 * @param aggrDefns
 * @param cubeQueryExcutorHelper
 * @return
 * @throws IOException
 * @throws BirtException
 */
private IAggregationResultSet[] populateRs(CubeQueryExecutor executor,AggregationDefinition[] aggrDefns,CubeQueryExecutorHelper cubeQueryExcutorHelper,boolean saveToRD) throws IOException, BirtException {
  IAggregationResultSet[] rs;
  String id=null;
  if (executor.getCubeQueryDefinition().getQueryResultsID() == null) {
    rs=cubeQueryExcutorHelper.execute(aggrDefns,new StopSign());
    if (executor.getCubeQueryDefinition().cacheQueryResults()) {
      id=QueryResultIDUtil.nextID();
      File tmpDir=new File(executor.getSession().getTempDir());
      if (!tmpDir.exists() || !tmpDir.isDirectory()) {
        tmpDir.mkdirs();
      }
      FileArchiveWriter writer=new FileArchiveWriter(executor.getSession().getTempDir() + "String_Node_Str");
      AggregationResultSetSaveUtil.save(id,rs,writer);
      writer.finish();
    }
    if (saveToRD) {
      if (id != null) {
        AggregationResultSetSaveUtil.save(id,rs,executor.getContext().getDocWriter());
      }
 else {
        id=QueryResultIDUtil.nextID();
        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());
  }
  executor.setQueryResultsId(id);
  return rs;
}