Program: 67498
Project: 67498
Buggy source:
/** 
 * resolve cell border conflict
 * @param cellArea
 */
public void resolveBorderConflict(CellArea cellArea,boolean isFirst){
  IContent cellContent=cellArea.getContent();
  int columnID=cellArea.getColumnID();
  int colSpan=cellArea.getColSpan();
  IRowContent row=(IRowContent)cellContent.getParent();
  IStyle cellContentStyle=cellContent.getComputedStyle();
  IStyle tableStyle=tableContent.getComputedStyle();
  IStyle rowStyle=row.getComputedStyle();
  IStyle columnStyle=getColumnStyle(columnID);
  IStyle preRowStyle=null;
  IStyle preColumnStyle=isRTL ? getColumnStyle(columnID + 1) : getColumnStyle(columnID - 1);
  IStyle leftCellContentStyle=null;
  IStyle topCellStyle=null;
  RowArea lastRow=null;
  if (rows.size() > 0) {
    lastRow=(RowArea)rows.getCurrent();
  }
  if (lastRow != null) {
    preRowStyle=lastRow.getContent().getComputedStyle();
    CellArea cell=lastRow.getCell(columnID);
    if (cell != null && cell.getContent() != null) {
      topCellStyle=cell.getContent().getComputedStyle();
    }
  }
  if ((!isRTL && columnID > startCol) || (isRTL && columnID + colSpan - 1 < endCol)) {
    leftCellContentStyle=getLeftCellContentStyle(lastRow,cellArea);
  }
  if (rows.size() == 0 && lastRow == null) {
    if (isFirst) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableTopBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
 else {
      if (tableStyle != null) {
        BorderInfo border=bcr.resolveTableTopBorder(tableStyle,null,columnStyle,null);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
    if ((columnID == startCol && !isRTL) || (columnID + colSpan - 1 == endCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableLeftBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
 else {
      if (leftCellContentStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellLeftBorder(preColumnStyle,columnStyle,leftCellContentStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
    if ((columnID + colSpan - 1 == endCol && !isRTL) || (columnID == startCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableRightBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setRightBorder(border);
        }
      }
    }
  }
 else {
    if (isFirst) {
      if (preRowStyle != null || rowStyle != null || topCellStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellTopBorder(preRowStyle,rowStyle,topCellStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
 else {
      if (preRowStyle != null || topCellStyle != null) {
        BorderInfo border=bcr.resolveCellTopBorder(preRowStyle,null,topCellStyle,null);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
    if ((columnID == startCol && !isRTL) || (columnID + colSpan - 1 == endCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableLeftBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
 else {
      if (leftCellContentStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellLeftBorder(preColumnStyle,columnStyle,leftCellContentStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
    if ((columnID + colSpan - 1 == endCol && !isRTL) || (columnID == startCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableRightBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setRightBorder(border);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * resolve cell border conflict
 * @param cellArea
 */
public void resolveBorderConflict(CellArea cellArea,boolean isFirst){
  IContent cellContent=cellArea.getContent();
  int columnID=cellArea.getColumnID();
  int colSpan=cellArea.getColSpan();
  IRowContent row=(IRowContent)cellContent.getParent();
  IStyle cellContentStyle=cellContent.getComputedStyle();
  IStyle tableStyle=tableContent.getComputedStyle();
  IStyle rowStyle=row.getComputedStyle();
  IStyle columnStyle=getColumnStyle(columnID);
  IStyle preRowStyle=null;
  IStyle preColumnStyle=getColumnStyle(columnID - 1);
  IStyle leftCellContentStyle=null;
  IStyle topCellStyle=null;
  RowArea lastRow=null;
  if (rows.size() > 0) {
    lastRow=(RowArea)rows.getCurrent();
  }
  if (lastRow != null) {
    preRowStyle=lastRow.getContent().getComputedStyle();
    CellArea cell=lastRow.getCell(columnID);
    if (cell != null && cell.getContent() != null) {
      topCellStyle=cell.getContent().getComputedStyle();
    }
  }
  if (columnID > startCol) {
    leftCellContentStyle=getLeftCellContentStyle(lastRow,cellArea);
  }
  if (rows.size() == 0 && lastRow == null) {
    if (isFirst) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableTopBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
 else {
      if (tableStyle != null) {
        BorderInfo border=bcr.resolveTableTopBorder(tableStyle,null,columnStyle,null);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
    if ((columnID == startCol && !isRTL) || (columnID + colSpan - 1 == endCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableLeftBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
 else     if (!isRTL) {
      if (leftCellContentStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellLeftBorder(preColumnStyle,columnStyle,leftCellContentStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
    if ((columnID + colSpan - 1 == endCol && !isRTL) || (columnID == startCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableRightBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setRightBorder(border);
        }
      }
    }
 else     if (isRTL && columnID > startCol && (leftCellContentStyle != null || cellContentStyle != null)) {
      BorderInfo border=bcr.resolveCellLeftBorder(columnStyle,preColumnStyle,cellContentStyle,leftCellContentStyle);
      if (border != null) {
        cellArea.getBoxStyle().setRightBorder(border);
      }
    }
  }
 else {
    if (isFirst) {
      if (preRowStyle != null || rowStyle != null || topCellStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellTopBorder(preRowStyle,rowStyle,topCellStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
 else {
      if (preRowStyle != null || topCellStyle != null) {
        BorderInfo border=bcr.resolveCellTopBorder(preRowStyle,null,topCellStyle,null);
        if (border != null) {
          cellArea.getBoxStyle().setTopBorder(border);
        }
      }
    }
    if ((columnID == startCol && !isRTL) || (columnID + colSpan - 1 == endCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableLeftBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
 else     if (!isRTL) {
      if (leftCellContentStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveCellLeftBorder(preColumnStyle,columnStyle,leftCellContentStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setLeftBorder(border);
        }
      }
    }
    if ((columnID + colSpan - 1 == endCol && !isRTL) || (columnID == startCol && isRTL)) {
      if (tableStyle != null || rowStyle != null || cellContentStyle != null) {
        BorderInfo border=bcr.resolveTableRightBorder(tableStyle,rowStyle,columnStyle,cellContentStyle);
        if (border != null) {
          cellArea.getBoxStyle().setRightBorder(border);
        }
      }
    }
 else     if (isRTL && columnID > startCol && (leftCellContentStyle != null || cellContentStyle != null)) {
      BorderInfo border=bcr.resolveCellLeftBorder(columnStyle,preColumnStyle,cellContentStyle,leftCellContentStyle);
      if (border != null) {
        cellArea.getBoxStyle().setRightBorder(border);
      }
    }
  }
}