Program: 69262
Project: 69262
Buggy source:
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  if (streamsWrapper.getStreamForGroupInfo() != null) {
    this.resultSetPopulator.getGroupProcessorManager().getGroupCalculationUtil().doSave(streamsWrapper.getStreamForGroupInfo());
  }
  if (isSubQuery == false && (!((IQueryDefinition)this.resultSetPopulator.getQuery().getQueryDefinition()).isSummaryQuery()) && streamsWrapper.getStreamForResultClass() != null) {
    ((ResultClass)this.resultSetPopulator.getResultSetMetadata()).doSave(streamsWrapper.getStreamForResultClass(),resultSetPopulator.getEventHandler().getAllColumnBindings());
    try {
      streamsWrapper.getStreamForResultClass().close();
      if (streamsWrapper.getStreamForDataSet() != null) {
        this.resultSetPopulator.getCache().doSave(streamsWrapper.getStreamForDataSet(),streamsWrapper.getStreamForDataSetRowLens(),resultSetPopulator.getEventHandler().getAllColumnBindings());
      }
      streamsWrapper.getStreamForDataSet().close();
      streamsWrapper.getStreamForDataSetRowLens().close();
    }
 catch (    IOException e) {
      logger.log(Level.FINE,e.getMessage(),e);
    }
  }
  if (streamsWrapper.getStreamManager().getVersion() >= VersionManager.VERSION_2_5_1_0) {
    if (!aggrHolderManager.isEmpty()) {
      aggrHolderManager.doSave(streamsWrapper.getStreamManager().getOutStream(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamsWrapper.getStreamManager().getOutStream(DataEngineContext.AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE));
    }
  }
}

Fixed version (ground truth):
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  if (streamsWrapper.getStreamForGroupInfo() != null) {
    this.resultSetPopulator.getGroupProcessorManager().getGroupCalculationUtil().doSave(streamsWrapper.getStreamForGroupInfo());
  }
  if (isSubQuery == false && (!isSummaryQuery(this.resultSetPopulator.getQuery())) && streamsWrapper.getStreamForResultClass() != null) {
    ((ResultClass)this.resultSetPopulator.getResultSetMetadata()).doSave(streamsWrapper.getStreamForResultClass(),resultSetPopulator.getEventHandler().getAllColumnBindings());
    try {
      streamsWrapper.getStreamForResultClass().close();
      if (streamsWrapper.getStreamForDataSet() != null) {
        this.resultSetPopulator.getCache().doSave(streamsWrapper.getStreamForDataSet(),streamsWrapper.getStreamForDataSetRowLens(),resultSetPopulator.getEventHandler().getAllColumnBindings());
      }
      streamsWrapper.getStreamForDataSet().close();
      streamsWrapper.getStreamForDataSetRowLens().close();
    }
 catch (    IOException e) {
      logger.log(Level.FINE,e.getMessage(),e);
    }
  }
  if (streamsWrapper.getStreamManager().getVersion() >= VersionManager.VERSION_2_5_1_0) {
    if (!aggrHolderManager.isEmpty()) {
      aggrHolderManager.doSave(streamsWrapper.getStreamManager().getOutStream(DataEngineContext.AGGR_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamsWrapper.getStreamManager().getOutStream(DataEngineContext.AGGR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE));
    }
  }
}