Program: 65867
Project: 65867
Buggy source:
/** 
 * @throws DataException
 */
protected void prepare() throws DataException {
  this.rdGroupUtil=RDLoadUtil.loadGroupUtil(tempDir,streamManager,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  if (version >= VersionManager.VERSION_2_5_1_0) {
    List<RAInputStream> aggrStreams=streamManager.getInStreams(DataEngineContext.AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    if ((!aggrStreams.isEmpty()) || streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
      List<RAInputStream> aggrIndexStreams=streamManager.getInStreams(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      RAInputStream combinedAggrIndex=null;
      RAInputStream combinedAggrValue=null;
      if (streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
        combinedAggrIndex=streamManager.getInStream(DataEngineContext.COMBINED_AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      }
      if (streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
        combinedAggrValue=streamManager.getInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      }
      this.aggrUtil=new ProgressiveViewingRDAggrUtil(combinedAggrIndex,combinedAggrValue,aggrIndexStreams,aggrStreams);
    }
 else     if (streamManager.hasInStream(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
      this.aggrUtil=new RDAggrUtil(streamManager,qd);
    }
  }
  if (this.isBasedOnSecondRD == false) {
    rowExprsRAIs=streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    if (version > VersionManager.VERSION_2_0) {
      rowLenRAIs=streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    this.exprResultReader=new ExprDataReader1(this.rowExprsRAIs,this.rowLenRAIs,this.version,(this.qd instanceof IQueryDefinition && ((IQueryDefinition)qd).isSummaryQuery()) ? null : this.dataSetResultSet);
    this.rowCount=exprResultReader.getCount();
  }
 else {
    rowExprsRAIs=streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
    rowLenRAIs=streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
    rowInfoRAIs=streamManager.getInStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    this.exprResultReader=new ExprDataReader2(tempDir,rowExprsRAIs,rowLenRAIs,rowInfoRAIs,version,(this.qd instanceof IQueryDefinition && ((IQueryDefinition)qd).isSummaryQuery()) ? null : this.dataSetResultSet);
    this.rowCount=this.exprResultReader.getCount();
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
protected void prepare() throws DataException {
  this.rdGroupUtil=RDLoadUtil.loadGroupUtil(tempDir,streamManager,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  if (version >= VersionManager.VERSION_2_5_1_0) {
    aggrStreams=streamManager.getInStreams(DataEngineContext.AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    if ((!aggrStreams.isEmpty()) || streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
      aggrIndexStreams=streamManager.getInStreams(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      RAInputStream combinedAggrIndex=null;
      RAInputStream combinedAggrValue=null;
      if (streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
        combinedAggrIndex=streamManager.getInStream(DataEngineContext.COMBINED_AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      }
      if (streamManager.hasInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
        combinedAggrValue=streamManager.getInStream(DataEngineContext.COMBINED_AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      }
      this.aggrUtil=new ProgressiveViewingRDAggrUtil(combinedAggrIndex,combinedAggrValue,aggrIndexStreams,aggrStreams);
    }
 else     if (streamManager.hasInStream(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE)) {
      this.aggrUtil=new RDAggrUtil(streamManager,qd);
    }
  }
  if (this.isBasedOnSecondRD == false) {
    rowExprsRAIs=streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    if (version > VersionManager.VERSION_2_0) {
      rowLenRAIs=streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    this.exprResultReader=new ExprDataReader1(this.rowExprsRAIs,this.rowLenRAIs,this.version,(this.qd instanceof IQueryDefinition && ((IQueryDefinition)qd).isSummaryQuery()) ? null : this.dataSetResultSet);
    this.rowCount=exprResultReader.getCount();
  }
 else {
    rowExprsRAIs=streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
    rowLenRAIs=streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
    rowInfoRAIs=streamManager.getInStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    this.exprResultReader=new ExprDataReader2(tempDir,rowExprsRAIs,rowLenRAIs,rowInfoRAIs,version,(this.qd instanceof IQueryDefinition && ((IQueryDefinition)qd).isSummaryQuery()) ? null : this.dataSetResultSet);
    this.rowCount=this.exprResultReader.getCount();
  }
}