Program: 72756
Project: 72756
Buggy source:
/** 
 * runs the report
 * @throws EngineException throws exception when there is a run error
 */
protected void doRun() throws EngineException {
  doValidateParameters();
  loadDesign();
  prepareDesign();
  startFactory();
  openReportDocument();
  try {
    ReportRunnable newRunnable=writer.saveDesign(executionContext.getRunnable(),executionContext.getOriginalRunnable());
    executionContext.updateRunnable(newRunnable);
    writer.saveReportIR(executionContext.getReport());
    writer.saveParamters(inputValues);
    executionContext.openDataEngine();
synchronized (this) {
      if (!executionContext.isCanceled()) {
        documentBuilder=new ReportDocumentBuilder(executionContext,writer);
      }
    }
    if (documentBuilder != null) {
      if (pageHandler != null) {
        documentBuilder.setPageHandler(pageHandler);
      }
      IContentEmitter emitter=documentBuilder.getContentEmitter();
      IReportExecutor executor=new ReportExecutor(executionContext);
      executor=new ReportEmitterExecutor(executor,emitter);
      executor=new SuppressDuplciateReportExecutor(executor);
      executionContext.setExecutor(executor);
      initializeContentEmitter(emitter,executor);
      documentBuilder.build();
    }
    executionContext.closeDataEngine();
  }
 catch (  Exception ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException("String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",t);
    throw new EngineException("String_Node_Str",t);
  }
 finally {
    documentBuilder=null;
    closeFactory();
    writer.savePersistentObjects(executionContext.getGlobalBeans());
    closeReportDocument();
    if (pageHandler != null && !executionContext.isCanceled()) {
      int totalPage=(int)executionContext.getTotalPage();
      IReportDocumentInfo docInfo=new ReportDocumentInfo(executionContext,totalPage,true);
      pageHandler.onPage(totalPage,true,docInfo);
    }
  }
}

Fixed version (ground truth):
/** 
 * runs the report
 * @throws EngineException throws exception when there is a run error
 */
protected void doRun() throws EngineException {
  doValidateParameters();
  loadDesign();
  prepareDesign();
  startFactory();
  openReportDocument();
  try {
    ReportRunnable newRunnable=writer.saveDesign(executionContext.getRunnable(),executionContext.getOriginalRunnable());
    executionContext.updateRunnable(newRunnable);
    writer.saveReportIR(executionContext.getReport());
    writer.saveParamters(inputValues);
    executionContext.openDataEngine();
synchronized (this) {
      if (!executionContext.isCanceled()) {
        documentBuilder=new ReportDocumentBuilder(executionContext,writer);
      }
    }
    if (documentBuilder != null) {
      if (pageHandler != null) {
        documentBuilder.setPageHandler(pageHandler);
      }
      IContentEmitter emitter=documentBuilder.getContentEmitter();
      IReportExecutor executor=new ReportExecutor(executionContext);
      executor=new ReportEmitterExecutor(executor,emitter);
      executor=new SuppressDuplciateReportExecutor(executor);
      executionContext.setExecutor(executor);
      initializeContentEmitter(emitter,executor);
      documentBuilder.build();
    }
    executionContext.closeDataEngine();
  }
 catch (  Exception ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException(MessageConstants.REPORT_RUN_ERROR,ex);
  }
catch (  OutOfMemoryError err) {
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",t);
    throw new EngineException(MessageConstants.REPORT_RUN_ERROR,t);
  }
 finally {
    documentBuilder=null;
    closeFactory();
    writer.savePersistentObjects(executionContext.getGlobalBeans());
    closeReportDocument();
    if (pageHandler != null && !executionContext.isCanceled()) {
      int totalPage=(int)executionContext.getTotalPage();
      IReportDocumentInfo docInfo=new ReportDocumentInfo(executionContext,totalPage,true);
      pageHandler.onPage(totalPage,true,docInfo);
    }
  }
}