Program: 65057
Project: 65057
Buggy source:
/** 
 * 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());
  }
}

Fixed version (ground truth):
/** 
 * assume leftborder is always draw
 * @param container
 */
protected void drawBorders(CellArea container){
  BoxStyle style=container.getBoxStyle();
  if (style == null)   return;
  writeSingleBorder(LEFTBORDERLINE,style.getLeftBorder());
  BorderInfo currentborderinfo=null;
  int additionalcol=0;
  int drawcurrentcolid=container.getColumnID();
  Integer additionalColSpan=mapignorecolumns.get(drawcurrentcolid);
  if (additionalColSpan != null) {
    additionalcol=additionalColSpan;
  }
  CellArea nextcell=((RowArea)container.getParent()).getCell(drawcurrentcolid + colspan + additionalcol);
  if (nextcell != null) {
    currentborderinfo=nextcell.getBoxStyle().getLeftBorder();
    writeSingleBorder(RIGHTBORDERLINE,currentborderinfo);
  }
  if (currentborderinfo == null) {
    writeSingleBorder(RIGHTBORDERLINE,style.getRightBorder());
  }
  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());
  }
}