Program: 77046
Project: 77046
Buggy source:
public void run() throws EngineException {
  setRunningFlag(true);
  if (!validateParameters()) {
    setRunningFlag(false);
    throw new EngineException(MessageConstants.INVALID_PARAMETER_EXCEPTION);
  }
  loadDesign();
  prepareDesign();
  startFactory();
  startRender();
  try {
    IContentEmitter emitter=createContentEmitter();
    Report reportDesign=executionContext.getReport();
    ReportExecutor executor=new ReportExecutor(executionContext,reportDesign,null);
    IReportExecutor lExecutor=new LocalizedReportExecutor(executionContext,executor);
    executionContext.setExecutor(executor);
    initializeContentEmitter(emitter,executor);
    if (ExtensionManager.NO_PAGINATION.equals(pagination)) {
      HTMLTableLayoutNestEmitter tableLayoutEmitter=new HTMLTableLayoutNestEmitter(emitter);
      lExecutor.execute(reportDesign.getReportDesign(),tableLayoutEmitter);
    }
 else {
      String format=executionContext.getOutputFormat();
      boolean paginate=true;
      if (FORMAT_HTML.equalsIgnoreCase(format)) {
        if (renderOptions instanceof HTMLRenderOption) {
          HTMLRenderOption htmlOption=(HTMLRenderOption)renderOptions;
          paginate=htmlOption.getHtmlPagination();
        }
      }
synchronized (this) {
        if (!executionContext.isCanceled()) {
          layoutEngine=LayoutEngineFactory.createLayoutEngine(pagination);
        }
      }
      if (layoutEngine != null) {
        OnPageBreakLayoutPageHandle handle=new OnPageBreakLayoutPageHandle(executionContext);
        layoutEngine.setPageHandler(handle);
        CompositeContentEmitter outputEmitters=new CompositeContentEmitter(format);
        outputEmitters.addEmitter(emitter);
        outputEmitters.addEmitter(handle.getEmitter());
        layoutEngine.layout(lExecutor,outputEmitters,paginate);
      }
    }
    closeRender();
    closeFactory();
  }
 catch (  EngineException e) {
    throw e;
  }
catch (  Exception ex) {
    ex.printStackTrace();
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException("String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    err.printStackTrace();
    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 {
    setRunningFlag(false);
  }
}

Fixed version (ground truth):
public void run() throws EngineException {
  setRunningFlag(true);
  if (!validateParameters()) {
    setRunningFlag(false);
    throw new EngineException(MessageConstants.INVALID_PARAMETER_EXCEPTION);
  }
  loadDesign();
  prepareDesign();
  startFactory();
  startRender();
  try {
    IContentEmitter emitter=createContentEmitter();
    Report reportDesign=executionContext.getReport();
    ReportExecutor executor=new ReportExecutor(executionContext,reportDesign,null);
    IReportExecutor lExecutor=new LocalizedReportExecutor(executionContext,executor);
    executionContext.setExecutor(executor);
    initializeContentEmitter(emitter,executor);
    if (ExtensionManager.NO_PAGINATION.equals(pagination)) {
      HTMLTableLayoutNestEmitter tableLayoutEmitter=new HTMLTableLayoutNestEmitter(emitter);
      lExecutor.execute(reportDesign.getReportDesign(),tableLayoutEmitter);
    }
 else {
      String format=executionContext.getOutputFormat();
      boolean paginate=true;
      if (FORMAT_HTML.equalsIgnoreCase(format)) {
        if (renderOptions instanceof HTMLRenderOption) {
          HTMLRenderOption htmlOption=(HTMLRenderOption)renderOptions;
          paginate=htmlOption.getHtmlPagination();
        }
      }
synchronized (this) {
        if (!executionContext.isCanceled()) {
          layoutEngine=LayoutEngineFactory.createLayoutEngine(pagination);
        }
      }
      if (layoutEngine != null) {
        CompositeLayoutPageHandler layoutPageHandler=new CompositeLayoutPageHandler();
        OnPageBreakLayoutPageHandle handle=new OnPageBreakLayoutPageHandle(executionContext);
        layoutPageHandler.addPageHandler(handle);
        layoutPageHandler.addPageHandler(new ContextPageBreakHandler(executionContext));
        layoutEngine.setPageHandler(layoutPageHandler);
        CompositeContentEmitter outputEmitters=new CompositeContentEmitter(format);
        outputEmitters.addEmitter(emitter);
        outputEmitters.addEmitter(handle.getEmitter());
        layoutEngine.layout(lExecutor,outputEmitters,paginate);
      }
    }
    closeRender();
    closeFactory();
  }
 catch (  EngineException e) {
    throw e;
  }
catch (  Exception ex) {
    ex.printStackTrace();
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException("String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    err.printStackTrace();
    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 {
    setRunningFlag(false);
  }
}