Program: 73055
Project: 73055
Buggy source:
/** 
 * This method will be invoked while a containerArea ends.
 * @param container the ContainerArea specified from layout
 */
protected void endContainer(IContainerArea container){
  currentX-=getX(container);
  currentY-=getY(container);
  if (container instanceof PageArea) {
    pageGraphic.dispose();
    if (((PageArea)container).isExtendToMultiplePages() && (extendDirection != EXTEND_NONE) && !extendDirectionMask) {
      int originalX=currentX;
      int originalY=currentY;
      if (extendDirection == EXTEND_ON_VERTICAL) {
        int startX=originalX;
        int startY=originalY + pageHeight;
        while (startY < maxHeight) {
          visitContainer(container,startX,startY);
          startY+=pageHeight;
        }
      }
 else       if (extendDirection == EXTEND_ON_HORIZONTAL) {
        int startX=originalX + pageWidth;
        int startY=originalY;
        while (startX < maxWidth) {
          visitContainer(container,startX,startY);
          startX+=pageWidth;
        }
      }
 else       if (extendDirection == EXTEND_ON_HORIZONTAL_AND_VERTICAL) {
        int startX=originalX + pageWidth;
        int startY=originalY;
        while (startY < maxHeight) {
          while (startX < maxWidth) {
            visitContainer(container,startX,startY);
            startX+=pageWidth;
          }
          startX=originalX;
          startY+=pageHeight;
        }
      }
      setExtendDirection(EXTEND_NONE);
      maxWidth=0;
      maxHeight=0;
    }
  }
 else {
    BorderInfo[] borders=cacheBorderInfo(container);
    if (container instanceof TableArea) {
      currentTableBorder.findBreakPoints();
      drawBorder(currentTableBorder);
      tableBorders.pop();
      if (!tableBorders.isEmpty()) {
        currentTableBorder=(TableBorder)tableBorders.peek();
      }
    }
 else     if (container instanceof CellArea) {
      CellArea cell=(CellArea)container;
      int cellX=currentX + cell.getX();
      int cellY=currentY + cell.getY();
      currentTableBorder.addRow(cellY + cell.getHeight());
      currentTableBorder.addColumn(cellX + cell.getWidth());
      if (null != borders && borders[BorderInfo.TOP_BORDER].borderWidth != 0) {
        currentTableBorder.setRowBorder(cellY,cellX,cellX + cell.getWidth(),borders[BorderInfo.TOP_BORDER].borderStyle,borders[BorderInfo.TOP_BORDER].borderWidth,borders[BorderInfo.TOP_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.LEFT_BORDER].borderWidth != 0) {
        currentTableBorder.setColumnBorder(cellX,cellY,cellY + cell.getHeight(),borders[BorderInfo.LEFT_BORDER].borderStyle,borders[BorderInfo.LEFT_BORDER].borderWidth,borders[BorderInfo.LEFT_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.BOTTOM_BORDER].borderWidth != 0) {
        currentTableBorder.setRowBorder(cellY + cell.getHeight(),cellX,cellX + cell.getWidth(),borders[BorderInfo.BOTTOM_BORDER].borderStyle,borders[BorderInfo.BOTTOM_BORDER].borderWidth,borders[BorderInfo.BOTTOM_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.RIGHT_BORDER].borderWidth != 0) {
        currentTableBorder.setColumnBorder(cellX + cell.getWidth(),cellY,cellY + cell.getHeight(),borders[BorderInfo.RIGHT_BORDER].borderStyle,borders[BorderInfo.RIGHT_BORDER].borderWidth,borders[BorderInfo.RIGHT_BORDER].borderColor);
      }
    }
 else {
      drawBorder(borders);
    }
    if (container.needClip()) {
      pageGraphic.clipRestore();
    }
  }
}

Fixed version (ground truth):
/** 
 * This method will be invoked while a containerArea ends.
 * @param container the ContainerArea specified from layout
 */
protected void endContainer(IContainerArea container){
  currentX-=getX(container);
  currentY-=getY(container);
  if (container instanceof PageArea) {
    pageGraphic.dispose();
    if (((PageArea)container).isExtendToMultiplePages() && (extendDirection != EXTEND_NONE) && !extendDirectionMask) {
      int originalX=currentX;
      int originalY=currentY;
      if (extendDirection == EXTEND_ON_VERTICAL) {
        int startX=originalX;
        int startY=originalY + pageHeight;
        while (startY < maxHeight) {
          visitContainer(container,startX,startY);
          startY+=pageHeight;
        }
      }
 else       if (extendDirection == EXTEND_ON_HORIZONTAL) {
        int startX=originalX + pageWidth;
        int startY=originalY;
        while (startX < maxWidth) {
          visitContainer(container,startX,startY);
          startX+=pageWidth;
        }
      }
 else       if (extendDirection == EXTEND_ON_HORIZONTAL_AND_VERTICAL) {
        int startX=originalX + pageWidth;
        int startY=originalY;
        while (startY < maxHeight) {
          while (startX < maxWidth) {
            visitContainer(container,startX,startY);
            startX+=pageWidth;
          }
          startX=originalX;
          startY+=pageHeight;
        }
      }
      setExtendDirection(EXTEND_NONE);
      maxWidth=0;
      maxHeight=0;
    }
  }
 else {
    BorderInfo[] borders=cacheBorderInfo(container);
    if (container instanceof TableArea) {
      currentTableBorder.findBreakPoints();
      drawBorder(currentTableBorder);
      tableBorders.pop();
      if (!tableBorders.isEmpty()) {
        currentTableBorder=(TableBorder)tableBorders.peek();
      }
    }
 else     if (container instanceof CellArea) {
      CellArea cell=(CellArea)container;
      int cellX=currentX + getX(cell);
      int cellY=currentY + getY(cell);
      int cellRx=currentX + getScaledValue(cell.getX() + cell.getWidth());
      int cellBy=currentY + getScaledValue(cell.getY() + cell.getHeight());
      currentTableBorder.addRow(cellBy);
      currentTableBorder.addColumn(cellRx);
      if (null != borders && borders[BorderInfo.TOP_BORDER].borderWidth != 0) {
        currentTableBorder.setRowBorder(cellY,cellX,cellRx,borders[BorderInfo.TOP_BORDER].borderStyle,borders[BorderInfo.TOP_BORDER].borderWidth,borders[BorderInfo.TOP_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.LEFT_BORDER].borderWidth != 0) {
        currentTableBorder.setColumnBorder(cellX,cellY,cellBy,borders[BorderInfo.LEFT_BORDER].borderStyle,borders[BorderInfo.LEFT_BORDER].borderWidth,borders[BorderInfo.LEFT_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.BOTTOM_BORDER].borderWidth != 0) {
        currentTableBorder.setRowBorder(cellBy,cellX,cellRx,borders[BorderInfo.BOTTOM_BORDER].borderStyle,borders[BorderInfo.BOTTOM_BORDER].borderWidth,borders[BorderInfo.BOTTOM_BORDER].borderColor);
      }
      if (null != borders && borders[BorderInfo.RIGHT_BORDER].borderWidth != 0) {
        currentTableBorder.setColumnBorder(cellRx,cellY,cellBy,borders[BorderInfo.RIGHT_BORDER].borderStyle,borders[BorderInfo.RIGHT_BORDER].borderWidth,borders[BorderInfo.RIGHT_BORDER].borderColor);
      }
    }
 else {
      drawBorder(borders);
    }
    if (container.needClip()) {
      pageGraphic.clipRestore();
    }
  }
}