Program: 78483
Project: 78483
Buggy source:
/** 
 * output the row. row is output as: row start, cells*, row end.
 * @param rowIndex the index in the rows
 * @param row row design
 * @param emitter output emitter
 */
protected void accessRow(RowDesign row,IContentEmitter emitter,IResultIterator rsIterator){
  IRowData rowData=null;
  if (context.isInFactory()) {
    rowData=new RowData(rsIterator,getValueExpressions(row));
  }
  if (rowClosed) {
    IRowContent rowContent=report.createRowContent();
    rowContent.setRowID(rowId++);
    assert(rowContent instanceof RowContent);
    IContent parent=context.getContent();
    context.pushContent(rowContent);
    initializeContent(parent,row,rowContent);
    processStyle(row,rowContent);
    processVisibility(row,rowContent);
    processBookmark(row,rowContent);
    processAction(row,rowContent);
    if (needPageBreak) {
      rowContent.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
      needPageBreak=false;
    }
    if (context.isInFactory()) {
      RowScriptExecutor.handleOnCreate((RowContent)rowContent,rowData,context);
    }
    startTOCEntry(rowContent);
    if (emitter != null) {
      emitter.startRow(rowContent);
    }
    rowClosed=false;
  }
  for (int j=0; j < row.getCellCount(); j++) {
    CellDesign cell=row.getCell(j);
    if (cell != null) {
      ICellContent cellContent=report.createCellContent();
      assert(cellContent instanceof CellContent);
      IContent parent=context.getContent();
      context.pushContent(cellContent);
      initializeContent(parent,cell,cellContent);
      cellContent.setColumn(cell.getColumn());
      cellContent.setColSpan(cell.getColSpan());
      cellContent.setRowSpan(cell.getRowSpan());
      processStyle(cell,cellContent);
      processVisibility(cell,cellContent);
      processBookmark(cell,cellContent);
      processAction(cell,cellContent);
      if (context.isInFactory()) {
        CellScriptExecutor.handleOnCreate((CellContent)cellContent,rowData,context,false);
      }
      startTOCEntry(cellContent);
      if (emitter != null) {
        emitter.startCell(cellContent);
      }
      for (int m=0; m < cell.getContentCount(); m++) {
        ReportItemDesign item=cell.getContent(m);
        if (item != null) {
          if (layoutEmitter != null) {
            item.accept(this.visitor,layoutEmitter.getCellEmitter());
          }
 else {
            item.accept(this.visitor,emitter);
          }
        }
      }
      if (emitter != null) {
        emitter.endCell(cellContent);
      }
      finishTOCEntry();
      context.popContent();
    }
  }
  boolean closeRow=true;
  if (closeRow) {
    emitter.endRow((IRowContent)context.getContent());
    finishTOCEntry();
    context.popContent();
    rowClosed=true;
  }
}

Fixed version (ground truth):
/** 
 * output the row. row is output as: row start, cells*, row end.
 * @param rowIndex the index in the rows
 * @param row row design
 * @param emitter output emitter
 */
protected void accessRow(RowDesign row,IContentEmitter emitter,IResultIterator rsIterator){
  IRowData rowData=null;
  if (context.isInFactory()) {
    rowData=new RowData(rsIterator,getValueExpressions(row));
  }
  if (rowClosed) {
    IRowContent rowContent=report.createRowContent();
    rowContent.setRowID(rowId++);
    assert(rowContent instanceof RowContent);
    IContent parent=context.getContent();
    context.pushContent(rowContent);
    initializeContent(parent,row,rowContent);
    processStyle(row,rowContent);
    processVisibility(row,rowContent);
    processBookmark(row,rowContent);
    processAction(row,rowContent);
    processRowType(row,rowContent);
    if (needPageBreak) {
      rowContent.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
      needPageBreak=false;
    }
    if (context.isInFactory()) {
      RowScriptExecutor.handleOnCreate((RowContent)rowContent,rowData,context);
    }
    startTOCEntry(rowContent);
    if (emitter != null) {
      emitter.startRow(rowContent);
    }
    rowClosed=false;
  }
  for (int j=0; j < row.getCellCount(); j++) {
    CellDesign cell=row.getCell(j);
    if (cell != null) {
      ICellContent cellContent=report.createCellContent();
      assert(cellContent instanceof CellContent);
      IContent parent=context.getContent();
      context.pushContent(cellContent);
      initializeContent(parent,cell,cellContent);
      cellContent.setColumn(cell.getColumn());
      cellContent.setColSpan(cell.getColSpan());
      cellContent.setRowSpan(cell.getRowSpan());
      processStyle(cell,cellContent);
      processVisibility(cell,cellContent);
      processBookmark(cell,cellContent);
      processAction(cell,cellContent);
      if (context.isInFactory()) {
        CellScriptExecutor.handleOnCreate((CellContent)cellContent,rowData,context,false);
      }
      startTOCEntry(cellContent);
      if (emitter != null) {
        emitter.startCell(cellContent);
      }
      for (int m=0; m < cell.getContentCount(); m++) {
        ReportItemDesign item=cell.getContent(m);
        if (item != null) {
          if (layoutEmitter != null) {
            item.accept(this.visitor,layoutEmitter.getCellEmitter());
          }
 else {
            item.accept(this.visitor,emitter);
          }
        }
      }
      if (emitter != null) {
        emitter.endCell(cellContent);
      }
      finishTOCEntry();
      context.popContent();
    }
  }
  boolean closeRow=true;
  if (closeRow) {
    emitter.endRow((IRowContent)context.getContent());
    finishTOCEntry();
    context.popContent();
    rowClosed=true;
  }
}