Program: 71432
Project: 71432
Buggy source:
/** 
 * @param eventHandler
 * @param stopSign
 * @param manager
 * @throws DataException
 * @throws IOException
 */
private void populatePLSDataSetData(IEventHandler eventHandler,StopSign stopSign,StreamManager manager) throws DataException, IOException {
  org.eclipse.birt.data.engine.impl.document.ResultIterator docIt=new org.eclipse.birt.data.engine.impl.document.ResultIterator(engine.getSession().getTempDir(),engine.getContext(),null,queryDefn.getQueryResultsID());
  PLSEnabledDataSetPopulator populator=new PLSEnabledDataSetPopulator(queryDefn,queryDefn.getQueryExecutionHints().getTargetGroupInstances(),docIt);
  ResultClass processedRC=(ResultClass)populateResultClass(populator.getResultClass());
  SmartCache cache=new SmartCache(new CacheRequest(0,new ArrayList(),null,eventHandler),new OdiAdapter(populator),processedRC,engine.getSession(),stopSign);
  manager.dropStream1(DataEngineContext.DATASET_DATA_STREAM);
  manager.dropStream1(DataEngineContext.DATASET_DATA_LEN_STREAM);
  OutputStream resultClassStream=manager.getOutStream(DataEngineContext.DATASET_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  processedRC.doSave(resultClassStream,new ArrayList(queryDefn.getBindings().values()));
  resultClassStream.close();
  DataOutputStream dataSetDataStream=new DataOutputStream(manager.getOutStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  DataOutputStream rowLensStream=new DataOutputStream(manager.getOutStream(DataEngineContext.DATASET_DATA_LEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  cache.doSave(dataSetDataStream,rowLensStream,eventHandler.getAllColumnBindings());
  cache.close();
  DataOutputStream plsGroupLevelStream=new DataOutputStream(manager.getOutStream(DataEngineContext.PLS_GROUPLEVEL_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  IOUtil.writeInt(plsGroupLevelStream,PLSUtil.getOutmostPlsGroupLevel(queryDefn));
  plsGroupLevelStream.close();
}

Fixed version (ground truth):
/** 
 * @param eventHandler
 * @param stopSign
 * @param manager
 * @throws DataException
 * @throws IOException
 */
private void populatePLSDataSetData(IEventHandler eventHandler,StopSign stopSign,StreamManager manager) throws DataException, IOException {
  org.eclipse.birt.data.engine.impl.document.ResultIterator docIt=new org.eclipse.birt.data.engine.impl.document.ResultIterator(engine.getSession().getTempDir(),engine.getContext(),null,queryDefn.getQueryResultsID());
  PLSEnabledDataSetPopulator populator=new PLSEnabledDataSetPopulator(queryDefn,queryDefn.getQueryExecutionHints().getTargetGroupInstances(),docIt);
  ResultClass processedRC=(ResultClass)populateResultClass(populator.getResultClass());
  SmartCache cache=new SmartCache(new CacheRequest(0,new ArrayList(),null,eventHandler),new OdiAdapter(populator),processedRC,engine.getSession(),stopSign);
  manager.dropStream1(DataEngineContext.DATASET_DATA_STREAM);
  manager.dropStream1(DataEngineContext.DATASET_DATA_LEN_STREAM);
  cleanUpOldRD();
  OutputStream resultClassStream=manager.getOutStream(DataEngineContext.DATASET_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  processedRC.doSave(resultClassStream,new ArrayList(queryDefn.getBindings().values()));
  resultClassStream.close();
  DataOutputStream dataSetDataStream=new DataOutputStream(manager.getOutStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  DataOutputStream rowLensStream=new DataOutputStream(manager.getOutStream(DataEngineContext.DATASET_DATA_LEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  cache.doSave(dataSetDataStream,rowLensStream,eventHandler.getAllColumnBindings());
  cache.close();
  DataOutputStream plsGroupLevelStream=new DataOutputStream(manager.getOutStream(DataEngineContext.PLS_GROUPLEVEL_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE));
  IOUtil.writeInt(plsGroupLevelStream,PLSUtil.getOutmostPlsGroupLevel(queryDefn));
  plsGroupLevelStream.close();
}