Program: 71227
Project: 71227
Buggy source:
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
switch (content.getContentType()) {
case IContent.TABLE_CONTENT:
    INode[] nodeList=currentBuffer.getNodeStack();
  nestCount--;
if (currentTableIndex == nestCount + 1 && currentTableIndex > 0) {
  assert(buffers != null);
  for (int i=0; i < buffers.length - 1; i++) {
    buffers[i].closePage(nodeList);
    buffers[i]=null;
  }
  buffers[buffers.length - 1].endContainer(content,finished,emitter,visible);
  context.getBufferFactory().refresh();
  currentBuffer=buffers[buffers.length - 1];
  currentTableIndex=-1;
}
 else {
  currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.TABLE_GROUP_CONTENT:
case IContent.TABLE_BAND_CONTENT:
case IContent.ROW_CONTENT:
if (currentTableIndex == nestCount && currentTableIndex > 0) {
if (pageBreakIndexs.length - 1 != currentIndex) {
for (int i=currentIndex; i < pageBreakIndexs.length; i++) {
  currentIndex=i;
  currentBuffer=buffers[currentIndex];
  repeatCells(emitter);
}
}
endContainerInPages(content,finished,emitter,visible);
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.CELL_CONTENT:
if (currentTableIndex == nestCount && currentTableIndex > 0) {
int pageIndex=needPageBreak((ICellContent)content);
if (pageIndex >= 0) {
currentBuffer.endContainer(content,false,emitter,visible);
for (int i=currentIndex + 1; i < pageIndex; i++) {
currentBuffer=buffers[i];
repeatCells(emitter);
currentBuffer.startContainer(content,false,emitter,visible);
currentBuffer.endContainer(content,finished,emitter,visible);
}
pageIndex=(pageIndex == pageBreakIndexs.length ? pageIndex - 1 : pageIndex);
currentBuffer=buffers[pageIndex];
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
if (isRepeatStatus) {
repeatEvent.add(new ContentEvent(content,visible,ContentEvent.END_CONTAINER_EVENT));
isRepeatStatus=false;
}
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.PAGE_CONTENT:
currentBuffer.endContainer(content,finished,emitter,visible);
context.getBufferFactory().refresh();
break;
default :
currentBuffer.endContainer(content,finished,emitter,visible);
break;
}
if (isRepeatStatus) {
repeatEvent.add(new ContentEvent(content,visible,ContentEvent.END_CONTAINER_EVENT));
}
}

Fixed version (ground truth):
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
switch (content.getContentType()) {
case IContent.TABLE_CONTENT:
    INode[] nodeList=currentBuffer.getNodeStack();
  nestCount--;
if (currentTableIndex == nestCount + 1 && currentTableIndex > 0) {
  assert(buffers != null);
  for (int i=0; i < buffers.length - 1; i++) {
    buffers[i].closePage(nodeList);
    buffers[i]=null;
  }
  buffers[buffers.length - 1].endContainer(content,finished,emitter,visible);
  context.getBufferFactory().refresh();
  currentBuffer=buffers[buffers.length - 1];
  currentTableIndex=-1;
}
 else {
  currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.TABLE_GROUP_CONTENT:
case IContent.TABLE_BAND_CONTENT:
case IContent.ROW_CONTENT:
if (currentTableIndex == nestCount && currentTableIndex > 0) {
if (pageBreakIndexs.length - 1 != currentIndex) {
for (int i=currentIndex; i < pageBreakIndexs.length; i++) {
  currentIndex=i;
  currentBuffer=buffers[currentIndex];
  repeatCells(emitter);
}
}
endContainerInPages(content,finished,emitter,visible);
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.CELL_CONTENT:
if (currentTableIndex == nestCount && currentTableIndex > 0) {
int pageIndex=needPageBreak((ICellContent)content);
if (pageIndex >= 0) {
currentBuffer.endContainer(content,finished,emitter,visible);
for (int i=currentIndex + 1; i < pageIndex; i++) {
currentBuffer=buffers[i];
repeatCells(emitter);
currentBuffer.startContainer(content,false,emitter,visible);
currentBuffer.endContainer(content,finished,emitter,visible);
}
pageIndex=(pageIndex == pageBreakIndexs.length ? pageIndex - 1 : pageIndex);
currentBuffer=buffers[pageIndex];
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
if (isRepeatStatus) {
repeatEvent.add(new ContentEvent(content,visible,ContentEvent.END_CONTAINER_EVENT));
isRepeatStatus=false;
}
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
break;
case IContent.PAGE_CONTENT:
currentBuffer.endContainer(content,finished,emitter,visible);
context.getBufferFactory().refresh();
break;
default :
currentBuffer.endContainer(content,finished,emitter,visible);
break;
}
if (isRepeatStatus) {
repeatEvent.add(new ContentEvent(content,visible,ContentEvent.END_CONTAINER_EVENT));
}
}