Program: 65176
Project: 65176
Buggy source:
/** 
 * assume leftborder is always draw
 * @param container
 */
protected void drawBorders(CellArea container){
  BoxStyle style=container.getBoxStyle();
  if (style == null)   return;
  BorderInfo baseborderinfo=style.getLeftBorder();
  writeSingleBorder(LEFTBORDERLINE,baseborderinfo);
  BorderInfo currentborderinfo=style.getRightBorder();
  if (currentborderinfo != null) {
    writeSingleBorder(RIGHTBORDERLINE,currentborderinfo);
    baseborderinfo=currentborderinfo;
  }
 else {
    CellArea nextcell=((RowArea)container.getParent()).getCell(currentCol + colspan);
    if (nextcell != null) {
      writeSingleBorder(RIGHTBORDERLINE,nextcell.getBoxStyle().getLeftBorder());
    }
  }
  writeSingleBorder(TOPBORDERLINE,style.getTopBorder());
  baseborderinfo=currentborderinfo;
  currentborderinfo=style.getBottomBorder();
  if (currentborderinfo != null) {
    writeSingleBorder(BOTTOMBORDERLINE,style.getBottomBorder());
  }
 else {
    IArea nextcontainer=container.getParent().getParent().getChild(currentRow + 1);
    RowArea ra=null;
    while (nextcontainer instanceof TableGroupArea) {
      nextcontainer=((TableGroupArea)nextcontainer).getFirstChild();
    }
    ra=(RowArea)nextcontainer;
    CellArea belowCell=null;
    if (ra != null) {
      belowCell=ra.getCell(currentCol);
      if (belowCell != null) {
        writeSingleBorder(BOTTOMBORDERLINE,belowCell.getBoxStyle().getTopBorder());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * assume leftborder is always draw
 * @param container
 */
protected void drawBorders(CellArea container){
  BoxStyle style=container.getBoxStyle();
  if (style == null)   return;
  BorderInfo currentborderinfo=style.getLeftBorder();
  writeSingleBorder(LEFTBORDERLINE,currentborderinfo);
  currentborderinfo=style.getRightBorder();
  if (currentborderinfo != null) {
    writeSingleBorder(RIGHTBORDERLINE,currentborderinfo);
  }
 else {
    CellArea nextcell=((RowArea)container.getParent()).getCell(currentCol + colspan);
    if (nextcell != null) {
      writeSingleBorder(RIGHTBORDERLINE,nextcell.getBoxStyle().getLeftBorder());
    }
  }
  writeSingleBorder(TOPBORDERLINE,style.getTopBorder());
  currentborderinfo=null;
  RowArea currentRowArea=(RowArea)container.getParent();
  ContainerArea grandparent=currentRowArea.getParent();
  IArea nextcontainer=grandparent.getChild(currentRowArea.getRowID() + 1);
  while (nextcontainer == null && grandparent instanceof TableGroupArea) {
    IArea currentTableGroup=grandparent;
    grandparent=grandparent.getParent();
    Iterator<IArea> rowiter=grandparent.getChildren();
    while (rowiter.hasNext() && !(rowiter.next().equals(currentTableGroup)))     ;
    if (rowiter.hasNext()) {
      nextcontainer=rowiter.next();
    }
  }
  RowArea ra=null;
  while (nextcontainer instanceof TableGroupArea) {
    nextcontainer=((TableGroupArea)nextcontainer).getFirstChild();
  }
  ra=(RowArea)nextcontainer;
  CellArea belowCell=null;
  if (ra != null) {
    belowCell=ra.getCell(currentCol);
    if (belowCell != null) {
      currentborderinfo=belowCell.getBoxStyle().getTopBorder();
      writeSingleBorder(BOTTOMBORDERLINE,currentborderinfo);
    }
  }
  if (currentborderinfo == null) {
    writeSingleBorder(BOTTOMBORDERLINE,style.getBottomBorder());
  }
}