Program: 76967
Project: 76967
Buggy source:
/** 
 * Initialize the helper.
 */
private void initialize(){
  int rowCount=owner.getRowCount();
  int colCount=owner.getColumnCount();
  heights=new int[colCount][rowCount + 1];
  widths=new int[rowCount][colCount + 1];
  borderData=new int[2 * colCount * rowCount + colCount + rowCount][5];
  for (int i=0; i < rowCount; i++) {
    for (int j=0; j < colCount; j++) {
      borderData[i * (2 * colCount + 1) + j][3]=-1;
      borderData[i * (2 * colCount + 1) + j][4]=-1;
      borderData[(i + 1) * (2 * colCount + 1) + j][3]=-1;
      borderData[(i + 1) * (2 * colCount + 1) + j][4]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j][3]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j][4]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j + 1][3]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j + 1][4]=-1;
    }
  }
  TableBorder tableBorder=(TableBorder)owner.getFigure().getBorder();
  Insets tableBorderInsets=tableBorder.getTrueBorderInsets();
  for (int i=0; i < colCount; i++) {
    heights[i][0]=tableBorderInsets.top;
    heights[i][rowCount]=tableBorderInsets.bottom;
  }
  for (int i=0; i < rowCount; i++) {
    widths[i][0]=tableBorderInsets.left;
    widths[i][colCount]=tableBorderInsets.right;
  }
  for (Iterator itr=owner.getChildren().iterator(); itr.hasNext(); ) {
    TableCellEditPart cellPart=(TableCellEditPart)itr.next();
    int rowIndex=cellPart.getRowNumber();
    int colIndex=cellPart.getColumnNumber();
    int rowSpan=cellPart.getRowSpan();
    int colSpan=cellPart.getColSpan();
    CellBorder border=(CellBorder)cellPart.getFigure().getBorder();
    Insets ins=border.getTrueBorderInsets();
    int topStyle=border.getTopBorderStyle();
    int topWidth=border.getTopBorderWidth();
    int topColor=border.getTopBorderColor();
    int bottomStyle=border.getBottomBorderStyle();
    int bottomWidth=border.getBottomBorderWidth();
    int bottomColor=border.getBottomBorderColor();
    int leftStyle=border.getLeftBorderStyle();
    int leftWidth=border.getLeftBorderWidth();
    int leftColor=border.getLeftBorderColor();
    int rightStyle=border.getRightBorderStyle();
    int rightWidth=border.getRightBorderWidth();
    int rightColor=border.getRightBorderColor();
    for (int i=0; i < colSpan; i++) {
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1) * (2 * colCount + 1) + colIndex - 1 + i],topStyle,topWidth,topColor,rowIndex - 1,colIndex - 1 + i);
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex + rowSpan - 1) * (2 * colCount + 1) + colIndex - 1 + i],bottomStyle,bottomWidth,bottomColor,rowIndex - 1 + rowSpan - 1,colIndex - 1 + i);
      heights[colIndex - 1 + i][rowIndex - 1]=Math.max(heights[colIndex - 1 + i][rowIndex - 1],ins.top);
      heights[colIndex - 1 + i][rowIndex + rowSpan - 1]=Math.max(heights[colIndex - 1 + i][rowIndex + rowSpan - 1],ins.bottom);
    }
    for (int i=0; i < rowSpan; i++) {
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex - 1],leftStyle,leftWidth,leftColor,rowIndex - 1 + i,colIndex - 1);
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex + colSpan - 1],rightStyle,rightWidth,rightColor,rowIndex - 1 + i,colIndex - 1 + colSpan - 1);
      widths[rowIndex - 1 + i][colIndex - 1]=Math.max(widths[rowIndex - 1 + i][colIndex - 1],ins.left);
      widths[rowIndex - 1 + i][colIndex + colSpan - 1]=Math.max(widths[rowIndex - 1 + i][colIndex + colSpan - 1],ins.right);
    }
  }
  int tableTopStyle=tableBorder.getTopBorderStyle();
  int tableTopWidth=tableBorder.getTopBorderWidth();
  if (tableTopStyle != 0 && tableTopWidth > 0) {
    int tableTopColor=tableBorder.getTopBorderColor();
    for (int i=0; i < colCount; i++) {
      borderData[i][0]=tableTopStyle;
      borderData[i][1]=tableTopWidth;
      borderData[i][2]=tableTopColor;
      borderData[i][3]=-2;
      borderData[i][4]=-2;
    }
  }
  int tableBottomStyle=tableBorder.getBottomBorderStyle();
  int tableBottomWidth=tableBorder.getBottomBorderWidth();
  if (tableBottomStyle != 0 && tableBottomWidth > 0) {
    int tableBottomColor=tableBorder.getBottomBorderColor();
    for (int i=0; i < colCount; i++) {
      borderData[2 * colCount * rowCount + rowCount + i][0]=tableBottomStyle;
      borderData[2 * colCount * rowCount + rowCount + i][1]=tableBottomWidth;
      borderData[2 * colCount * rowCount + rowCount + i][2]=tableBottomColor;
      borderData[2 * colCount * rowCount + rowCount + i][3]=-2;
      borderData[2 * colCount * rowCount + rowCount + i][4]=-2;
    }
  }
  int tableLeftStyle=tableBorder.getLeftBorderStyle();
  int tableLeftWidth=tableBorder.getLeftBorderWidth();
  if (tableLeftStyle != 0 && tableLeftWidth > 0) {
    int tableLeftColor=tableBorder.getLeftBorderColor();
    for (int i=0; i < rowCount; i++) {
      borderData[(2 * colCount + 1) * i + colCount][0]=tableLeftStyle;
      borderData[(2 * colCount + 1) * i + colCount][1]=tableLeftWidth;
      borderData[(2 * colCount + 1) * i + colCount][2]=tableLeftColor;
      borderData[(2 * colCount + 1) * i + colCount][3]=-2;
      borderData[(2 * colCount + 1) * i + colCount][4]=-2;
    }
  }
  int tableRightStyle=tableBorder.getRightBorderStyle();
  int tableRightWidth=tableBorder.getRightBorderWidth();
  if (tableRightStyle != 0 && tableRightWidth > 0) {
    int tableRightColor=tableBorder.getRightBorderColor();
    for (int i=0; i < rowCount; i++) {
      borderData[(2 * colCount + 1) * i + 2 * colCount][0]=tableRightStyle;
      borderData[(2 * colCount + 1) * i + 2 * colCount][1]=tableRightWidth;
      borderData[(2 * colCount + 1) * i + 2 * colCount][2]=tableRightColor;
      borderData[(2 * colCount + 1) * i + 2 * colCount][3]=-2;
      borderData[(2 * colCount + 1) * i + 2 * colCount][4]=-2;
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialize the helper.
 */
private void initialize(){
  int rowCount=owner.getRowCount();
  int colCount=owner.getColumnCount();
  heights=new int[colCount][rowCount + 1];
  widths=new int[rowCount][colCount + 1];
  borderData=new int[2 * colCount * rowCount + colCount + rowCount][6];
  for (int i=0; i < rowCount; i++) {
    for (int j=0; j < colCount; j++) {
      borderData[i * (2 * colCount + 1) + j][3]=-1;
      borderData[i * (2 * colCount + 1) + j][4]=-1;
      borderData[i * (2 * colCount + 1) + j][5]=-1;
      borderData[(i + 1) * (2 * colCount + 1) + j][3]=-1;
      borderData[(i + 1) * (2 * colCount + 1) + j][4]=-1;
      borderData[(i + 1) * (2 * colCount + 1) + j][5]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j][3]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j][4]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j][5]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j + 1][3]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j + 1][4]=-1;
      borderData[i * (2 * colCount + 1) + colCount + j + 1][5]=-1;
    }
  }
  TableBorder tableBorder=(TableBorder)owner.getFigure().getBorder();
  Insets tableBorderInsets=tableBorder.getTrueBorderInsets();
  for (int i=0; i < colCount; i++) {
    heights[i][0]=tableBorderInsets.top;
    heights[i][rowCount]=tableBorderInsets.bottom;
  }
  for (int i=0; i < rowCount; i++) {
    widths[i][0]=tableBorderInsets.left;
    widths[i][colCount]=tableBorderInsets.right;
  }
  for (Iterator itr=owner.getChildren().iterator(); itr.hasNext(); ) {
    TableCellEditPart cellPart=(TableCellEditPart)itr.next();
    int rowIndex=cellPart.getRowNumber();
    int colIndex=cellPart.getColumnNumber();
    int rowSpan=cellPart.getRowSpan();
    int colSpan=cellPart.getColSpan();
    CellBorder border=(CellBorder)cellPart.getFigure().getBorder();
    Insets ins=border.getTrueBorderInsets();
    int topStyle=border.getTopBorderStyle();
    int topWidth=border.getTopBorderWidth();
    int topColor=border.getTopBorderColor();
    int topFrom=border.getTopFrom();
    int bottomStyle=border.getBottomBorderStyle();
    int bottomWidth=border.getBottomBorderWidth();
    int bottomColor=border.getBottomBorderColor();
    int bottomFrom=border.getBottomFrom();
    int leftStyle=border.getLeftBorderStyle();
    int leftWidth=border.getLeftBorderWidth();
    int leftColor=border.getLeftBorderColor();
    int rightStyle=border.getRightBorderStyle();
    int rightWidth=border.getRightBorderWidth();
    int rightColor=border.getRightBorderColor();
    for (int i=0; i < colSpan; i++) {
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1) * (2 * colCount + 1) + colIndex - 1 + i],topStyle,topWidth,topColor,rowIndex - 1,colIndex - 1 + i,topFrom);
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex + rowSpan - 1) * (2 * colCount + 1) + colIndex - 1 + i],bottomStyle,bottomWidth,bottomColor,rowIndex - 1 + rowSpan - 1,colIndex - 1 + i,bottomFrom);
      heights[colIndex - 1 + i][rowIndex - 1]=Math.max(heights[colIndex - 1 + i][rowIndex - 1],ins.top);
      heights[colIndex - 1 + i][rowIndex + rowSpan - 1]=Math.max(heights[colIndex - 1 + i][rowIndex + rowSpan - 1],ins.bottom);
    }
    for (int i=0; i < rowSpan; i++) {
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex - 1],leftStyle,leftWidth,leftColor,rowIndex - 1 + i,colIndex - 1);
      TableBorderCollisionArbiter.refreshBorderData(borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex + colSpan - 1],rightStyle,rightWidth,rightColor,rowIndex - 1 + i,colIndex - 1 + colSpan - 1);
      widths[rowIndex - 1 + i][colIndex - 1]=Math.max(widths[rowIndex - 1 + i][colIndex - 1],ins.left);
      widths[rowIndex - 1 + i][colIndex + colSpan - 1]=Math.max(widths[rowIndex - 1 + i][colIndex + colSpan - 1],ins.right);
    }
  }
  int tableTopStyle=tableBorder.getTopBorderStyle();
  int tableTopWidth=tableBorder.getTopBorderWidth();
  if (tableTopStyle != 0 && tableTopWidth > 0) {
    int tableTopColor=tableBorder.getTopBorderColor();
    for (int i=0; i < colCount; i++) {
      borderData[i][0]=tableTopStyle;
      borderData[i][1]=tableTopWidth;
      borderData[i][2]=tableTopColor;
      borderData[i][3]=-2;
      borderData[i][4]=-2;
    }
  }
  int tableBottomStyle=tableBorder.getBottomBorderStyle();
  int tableBottomWidth=tableBorder.getBottomBorderWidth();
  if (tableBottomStyle != 0 && tableBottomWidth > 0) {
    int tableBottomColor=tableBorder.getBottomBorderColor();
    for (int i=0; i < colCount; i++) {
      borderData[2 * colCount * rowCount + rowCount + i][0]=tableBottomStyle;
      borderData[2 * colCount * rowCount + rowCount + i][1]=tableBottomWidth;
      borderData[2 * colCount * rowCount + rowCount + i][2]=tableBottomColor;
      borderData[2 * colCount * rowCount + rowCount + i][3]=-2;
      borderData[2 * colCount * rowCount + rowCount + i][4]=-2;
    }
  }
  int tableLeftStyle=tableBorder.getLeftBorderStyle();
  int tableLeftWidth=tableBorder.getLeftBorderWidth();
  if (tableLeftStyle != 0 && tableLeftWidth > 0) {
    int tableLeftColor=tableBorder.getLeftBorderColor();
    for (int i=0; i < rowCount; i++) {
      borderData[(2 * colCount + 1) * i + colCount][0]=tableLeftStyle;
      borderData[(2 * colCount + 1) * i + colCount][1]=tableLeftWidth;
      borderData[(2 * colCount + 1) * i + colCount][2]=tableLeftColor;
      borderData[(2 * colCount + 1) * i + colCount][3]=-2;
      borderData[(2 * colCount + 1) * i + colCount][4]=-2;
    }
  }
  int tableRightStyle=tableBorder.getRightBorderStyle();
  int tableRightWidth=tableBorder.getRightBorderWidth();
  if (tableRightStyle != 0 && tableRightWidth > 0) {
    int tableRightColor=tableBorder.getRightBorderColor();
    for (int i=0; i < rowCount; i++) {
      borderData[(2 * colCount + 1) * i + 2 * colCount][0]=tableRightStyle;
      borderData[(2 * colCount + 1) * i + 2 * colCount][1]=tableRightWidth;
      borderData[(2 * colCount + 1) * i + 2 * colCount][2]=tableRightColor;
      borderData[(2 * colCount + 1) * i + 2 * colCount][3]=-2;
      borderData[(2 * colCount + 1) * i + 2 * colCount][4]=-2;
    }
  }
}