Program: 72766
Project: 72766
Buggy source:
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
switch (content.getContentType()) {
case IContent.TABLE_CONTENT:
    IContent[] contentList=currentBuffer.getContentStack();
  nestCount--;
if (currentTableIndex == nestCount + 1 && currentTableIndex > 0) {
  assert(buffers != null);
  for (int i=0; i < buffers.length - 1; i++) {
    buffers[i].closePage(contentList,emitter);
  }
  buffers[buffers.length - 1].endContainer(content,finished,emitter,visible);
  context.getBufferFactory().refresh();
  currentBuffer=buffers[buffers.length - 1];
  buffers=null;
}
 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) {
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);
currentBuffer=buffers[pageIndex];
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
}
 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;
}
}

Fixed version (ground truth):
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
switch (content.getContentType()) {
case IContent.TABLE_CONTENT:
    IContent[] contentList=currentBuffer.getContentStack();
  nestCount--;
if (currentTableIndex == nestCount + 1 && currentTableIndex > 0) {
  assert(buffers != null);
  for (int i=0; i < buffers.length - 1; i++) {
    buffers[i].closePage(contentList,emitter);
  }
  buffers[buffers.length - 1].endContainer(content,finished,emitter,visible);
  context.getBufferFactory().refresh();
  currentBuffer=buffers[buffers.length - 1];
  buffers=null;
  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) {
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);
currentBuffer=buffers[pageIndex];
}
 else {
currentBuffer.endContainer(content,finished,emitter,visible);
}
}
 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;
}
}