Program: 75215
Project: 75215
Buggy source:
/** 
 * runs the report
 * @throws EngineException throws exception when there is a run error
 */
protected void doRun() throws EngineException {
  if (!validateParameters()) {
    throw new EngineException(MessageConstants.INVALID_PARAMETER_EXCEPTION);
  }
  loadDesign();
  prepareDesign();
  startFactory();
  openReportDocument();
  try {
    ReportRunnable report=executionContext.getRunnable();
    writer.saveDesign(report);
    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 report=executionContext.getRunnable();
    writer.saveDesign(report);
    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);
    }
  }
}