Program: 75871
Project: 75871
Buggy source:
/** 
 * Handles the style of a cell
 * @param cell:the cell content
 * @param styleBuffer:the buffer to store the tyle building result.
 */
protected void buildCellBaseStyle(ICellContent cell,StringBuffer styleBuffer){
  IStyle style=null;
  if (isEmbeddable) {
    style=cell.getStyle();
  }
 else {
    style=cell.getInlineStyle();
  }
  AttributeBuilder.buildCellStyle(styleBuffer,style,parentEmitter);
  int columnCount=-1;
  IStyle cellStyle=null, cellComputedStyle=null;
  IStyle rowStyle=null, rowComputedStyle=null;
  cellStyle=cell.getStyle();
  cellComputedStyle=cell.getComputedStyle();
  IRowContent row=(IRowContent)cell.getParent();
  if (null != row) {
    rowStyle=row.getStyle();
    rowComputedStyle=row.getComputedStyle();
    ITableContent table=row.getTable();
    if (null != table) {
      columnCount=table.getColumnCount();
    }
  }
  if (null == rowStyle || cell.getColumn() < 0 || columnCount < 1) {
    if (null != cellStyle) {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,cellStyle.getBorderTopWidth(),cellStyle.getBorderTopStyle(),cellStyle.getBorderTopColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,cellStyle.getBorderBottomWidth(),cellStyle.getBorderBottomStyle(),cellStyle.getBorderBottomColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),0,null,null,null,0);
    }
  }
 else   if (null == cellStyle) {
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,null,null,null,0,rowStyle.getBorderTopWidth(),rowStyle.getBorderTopStyle(),rowStyle.getBorderTopColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,null,null,null,0,rowStyle.getBorderRightWidth(),rowStyle.getBorderRightStyle(),rowStyle.getBorderRightColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,null,null,null,0,rowStyle.getBorderBottomWidth(),rowStyle.getBorderBottomStyle(),rowStyle.getBorderBottomColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,null,null,null,0,rowStyle.getBorderLeftWidth(),rowStyle.getBorderLeftStyle(),rowStyle.getBorderLeftColor(),0);
  }
 else {
    int cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_TOP_WIDTH);
    int rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_TOP_WIDTH);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,cellStyle.getBorderTopWidth(),cellStyle.getBorderTopStyle(),cellStyle.getBorderTopColor(),cellWidthValue,rowStyle.getBorderTopWidth(),rowStyle.getBorderTopStyle(),rowStyle.getBorderTopColor(),rowWidthValue);
    if ((cell.getColumn() + cell.getColSpan()) == columnCount) {
      cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_RIGHT_WIDTH);
      rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_RIGHT_WIDTH);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),cellWidthValue,rowStyle.getBorderRightWidth(),rowStyle.getBorderRightStyle(),rowStyle.getBorderRightColor(),rowWidthValue);
    }
 else {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),0,null,null,null,0);
    }
    cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_BOTTOM_WIDTH);
    rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_BOTTOM_WIDTH);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,cellStyle.getBorderBottomWidth(),cellStyle.getBorderBottomStyle(),cellStyle.getBorderBottomColor(),cellWidthValue,rowStyle.getBorderBottomWidth(),rowStyle.getBorderBottomStyle(),rowStyle.getBorderBottomColor(),rowWidthValue);
    if (cell.getColumn() == 0) {
      cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_LEFT_WIDTH);
      rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_LEFT_WIDTH);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),cellWidthValue,rowStyle.getBorderLeftWidth(),rowStyle.getBorderLeftStyle(),rowStyle.getBorderLeftColor(),rowWidthValue);
    }
 else {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),0,null,null,null,0);
    }
  }
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
}

Fixed version (ground truth):
/** 
 * Handles the style of a cell
 * @param cell:the cell content
 * @param styleBuffer:the buffer to store the tyle building result.
 */
protected void buildCellBaseStyle(ICellContent cell,StringBuffer styleBuffer){
  IStyle style=null;
  if (isEmbeddable) {
    style=cell.getStyle();
  }
 else {
    style=cell.getInlineStyle();
  }
  AttributeBuilder.buildCellStyle(styleBuffer,style,parentEmitter);
  int columnCount=-1;
  IStyle cellStyle=null, cellComputedStyle=null;
  IStyle rowStyle=null, rowComputedStyle=null;
  cellStyle=cell.getStyle();
  cellComputedStyle=cell.getComputedStyle();
  IRowContent row=(IRowContent)cell.getParent();
  if (null != row) {
    rowStyle=row.getStyle();
    rowComputedStyle=row.getComputedStyle();
    ITableContent table=row.getTable();
    if (null != table) {
      columnCount=table.getColumnCount();
    }
  }
  if (null == rowStyle || cell.getColumn() < 0 || columnCount < 1) {
    if (null != cellStyle) {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,cellStyle.getBorderTopWidth(),cellStyle.getBorderTopStyle(),cellStyle.getBorderTopColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,cellStyle.getBorderBottomWidth(),cellStyle.getBorderBottomStyle(),cellStyle.getBorderBottomColor(),0,null,null,null,0);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),0,null,null,null,0);
    }
  }
 else   if (null == cellStyle) {
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,null,null,null,0,rowStyle.getBorderTopWidth(),rowStyle.getBorderTopStyle(),rowStyle.getBorderTopColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,null,null,null,0,rowStyle.getBorderRightWidth(),rowStyle.getBorderRightStyle(),rowStyle.getBorderRightColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,null,null,null,0,rowStyle.getBorderBottomWidth(),rowStyle.getBorderBottomStyle(),rowStyle.getBorderBottomColor(),0);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,null,null,null,0,rowStyle.getBorderLeftWidth(),rowStyle.getBorderLeftStyle(),rowStyle.getBorderLeftColor(),0);
  }
 else {
    int cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_TOP_WIDTH);
    int rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_TOP_WIDTH);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_TOP,cellStyle.getBorderTopWidth(),cellStyle.getBorderTopStyle(),cellStyle.getBorderTopColor(),cellWidthValue,rowStyle.getBorderTopWidth(),rowStyle.getBorderTopStyle(),rowStyle.getBorderTopColor(),rowWidthValue);
    if ((cell.getColumn() + cell.getColSpan()) == columnCount) {
      cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_RIGHT_WIDTH);
      rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_RIGHT_WIDTH);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),cellWidthValue,rowStyle.getBorderRightWidth(),rowStyle.getBorderRightStyle(),rowStyle.getBorderRightColor(),rowWidthValue);
    }
 else {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_RIGHT,cellStyle.getBorderRightWidth(),cellStyle.getBorderRightStyle(),cellStyle.getBorderRightColor(),0,null,null,null,0);
    }
    cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_BOTTOM_WIDTH);
    rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_BOTTOM_WIDTH);
    buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_BOTTOM,cellStyle.getBorderBottomWidth(),cellStyle.getBorderBottomStyle(),cellStyle.getBorderBottomColor(),cellWidthValue,rowStyle.getBorderBottomWidth(),rowStyle.getBorderBottomStyle(),rowStyle.getBorderBottomColor(),rowWidthValue);
    if (cell.getColumn() == 0) {
      cellWidthValue=getBorderWidthValue(cellComputedStyle,IStyle.STYLE_BORDER_LEFT_WIDTH);
      rowWidthValue=getBorderWidthValue(rowComputedStyle,IStyle.STYLE_BORDER_LEFT_WIDTH);
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),cellWidthValue,rowStyle.getBorderLeftWidth(),rowStyle.getBorderLeftStyle(),rowStyle.getBorderLeftColor(),rowWidthValue);
    }
 else {
      buildCellRowBorder(styleBuffer,HTMLTags.ATTR_BORDER_LEFT,cellStyle.getBorderLeftWidth(),cellStyle.getBorderLeftStyle(),cellStyle.getBorderLeftColor(),0,null,null,null,0);
    }
  }
}