Program: 79285
Project: 79285
Buggy source:
/** 
 * Insert a row to a specific position.
 * @param rowNumber The row number. 1 insert after position. -1 insert before position
 * @param parentRowNumber The row number in the table.
 * @throws SemanticException
 */
public void insertRow(int rowNumber,int parentRowNumber) throws SemanticException {
  transStar(TRANS_LABEL_INSERT_ROW);
  Assert.isLegal(rowNumber != 0);
  int realRowNumber=rowNumber > 0 ? parentRowNumber + rowNumber : parentRowNumber + rowNumber + 1;
  int shiftPos=rowNumber > 0 ? rowNumber : rowNumber + 1;
  RowHandle row=(RowHandle)getRow(parentRowNumber);
  RowHandleAdapter adapt=HandleAdapterFactory.getInstance().getRowHandleAdapter(row);
  RowHandle copy=(RowHandle)adapt.copy();
  TableHandleAdapter.RowUIInfomation rowInfo=getRowInfo(row);
  List rowList=rowInfo.getAllChildren();
  int rowSize=rowList.size();
  for (int i=0; i < rowSize; i++) {
    CellHandle parentCell=(CellHandle)rowList.get(i);
    CellHandle cell=getCellHandleCopy(parentCell);
    copy.getSlot(TableRow.CONTENT_SLOT).add(cell);
  }
  SlotHandle parentHandle=row.getContainerSlotHandle();
  parentHandle.add((copy));
  int pos=parentHandle.findPosn(row.getElement());
  parentHandle.shift(copy,pos + shiftPos);
  RowHandleAdapter copyAdapt=HandleAdapterFactory.getInstance().getRowHandleAdapter(copy);
  List copyChildren=copyAdapt.getChildren();
  TableHandleAdapter.RowUIInfomation info=getRowInfo(copy);
  List list=info.getAllChildren();
  List temp=new ArrayList();
  int size=list.size();
  List hasAdjust=new ArrayList();
  for (int i=0; i < size; i++) {
    Object fillCell=list.get(i);
    CellHandleAdapter cellAdapt=HandleAdapterFactory.getInstance().getCellHandleAdapter(fillCell);
    if (cellAdapt.getRowNumber() != realRowNumber) {
      if (!hasAdjust.contains(fillCell)) {
        cellAdapt.setRowSpan(cellAdapt.getRowSpan() + 1);
        hasAdjust.add(fillCell);
      }
      temp.add(new Integer(i));
    }
  }
  int copyRowSize=copyChildren.size();
  for (int i=0; i < copyRowSize; i++) {
    if (temp.contains(new Integer(i))) {
      ((CellHandle)copyChildren.get(i)).drop();
    }
  }
  transEnd();
}

Fixed version (ground truth):
/** 
 * Insert a row to a specific position.
 * @param rowNumber The row number. 1 insert after position. -1 insert before position
 * @param parentRowNumber The row number in the table.
 * @throws SemanticException
 */
public void insertRow(int rowNumber,int parentRowNumber) throws SemanticException {
  transStar(TRANS_LABEL_INSERT_ROW);
  Assert.isLegal(rowNumber != 0);
  int realRowNumber=rowNumber > 0 ? parentRowNumber + rowNumber : parentRowNumber + rowNumber + 1;
  int shiftPos=rowNumber > 0 ? rowNumber : rowNumber + 1;
  RowHandle row=(RowHandle)getRow(parentRowNumber);
  RowHandleAdapter adapt=HandleAdapterFactory.getInstance().getRowHandleAdapter(row);
  RowHandle copy=(RowHandle)adapt.copy();
  TableHandleAdapter.RowUIInfomation rowInfo=getRowInfo(row);
  List rowList=rowInfo.getAllChildren();
  int rowSize=rowList.size();
  for (int i=0; i < rowSize; i++) {
    CellHandle parentCell=(CellHandle)rowList.get(i);
    CellHandle cell=getCellHandleCopy(parentCell);
    copy.getSlot(TableRow.CONTENT_SLOT).add(cell);
  }
  SlotHandle parentHandle=row.getContainerSlotHandle();
  parentHandle.add((copy));
  int pos=parentHandle.findPosn(row);
  parentHandle.shift(copy,pos + shiftPos);
  RowHandleAdapter copyAdapt=HandleAdapterFactory.getInstance().getRowHandleAdapter(copy);
  List copyChildren=copyAdapt.getChildren();
  TableHandleAdapter.RowUIInfomation info=getRowInfo(copy);
  List list=info.getAllChildren();
  List temp=new ArrayList();
  int size=list.size();
  List hasAdjust=new ArrayList();
  for (int i=0; i < size; i++) {
    Object fillCell=list.get(i);
    CellHandleAdapter cellAdapt=HandleAdapterFactory.getInstance().getCellHandleAdapter(fillCell);
    if (cellAdapt.getRowNumber() != realRowNumber) {
      if (!hasAdjust.contains(fillCell)) {
        cellAdapt.setRowSpan(cellAdapt.getRowSpan() + 1);
        hasAdjust.add(fillCell);
      }
      temp.add(new Integer(i));
    }
  }
  int copyRowSize=copyChildren.size();
  for (int i=0; i < copyRowSize; i++) {
    if (temp.contains(new Integer(i))) {
      ((CellHandle)copyChildren.get(i)).drop();
    }
  }
  transEnd();
}