Program: 36990
Project: 36990
Buggy source:
/** 
 * Process table header.
 * @param table the table
 * @param cells the cells
 * @param rowshead the rowshead
 * @param headrowscount the headrowscount
 * @param num_of_columns the num_of_columns
 * @return the table
 */
public Table ProcessTableHeader(Table table,Cell[][] cells,List<Node> rowshead,int headrowscount,int num_of_columns){
  for (int j=0; j < headrowscount; j++) {
    Statistics.addHeaderRow();
    table.stat.AddHeaderRow();
    List<Node> tds=getChildrenByTagName(rowshead.get(j),"String_Node_Str");
    if (tds.size() == 0)     tds=getChildrenByTagName(rowshead.get(j),"String_Node_Str");
    int index=0;
    for (int k=0; k < tds.size(); k++) {
      boolean is_colspanning=false;
      boolean is_rowspanning=false;
      int colspanVal=1;
      int rowspanVal=1;
      if (tds.get(k).getAttributes().getNamedItem("String_Node_Str") != null && Utilities.isNumeric(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) && Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) > 1) {
        table.setRowSpanning(true);
        Statistics.addRowSpanningCell();
        table.stat.AddRowSpanningCell();
        is_rowspanning=true;
        rowspanVal=Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue());
      }
      if (tds.get(k).getAttributes().getNamedItem("String_Node_Str") != null && Utilities.isNumeric(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) && Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) > 1) {
        table.setColSpanning(true);
        Statistics.addColumnSpanningCell();
        table.stat.AddColSpanningCell();
        is_colspanning=true;
        colspanVal=Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue());
      }
      for (int l=0; l < colspanVal; l++) {
        int rowindex=j;
        for (int s=0; s < rowspanVal; s++) {
          try {
            while (cells[rowindex][index].isIs_filled() && index != num_of_columns)             index++;
            cells[rowindex][index]=Cell.setCellValues(cells[rowindex][index],tds.get(k).getTextContent(),is_colspanning,colspanVal,is_rowspanning,rowspanVal,true,1,false,0,index,rowindex,l,s);
            table=Statistics.statisticsForCell(table,cells[rowindex][index]);
          }
 catch (          Exception ex) {
            System.out.println("String_Node_Str");
          }
          rowindex++;
        }
        index++;
      }
    }
  }
  return table;
}

Fixed version (ground truth):
/** 
 * Process table header.
 * @param table the table
 * @param cells the cells
 * @param rowshead the rowshead
 * @param headrowscount the headrowscount
 * @param num_of_columns the num_of_columns
 * @return the table
 */
public Table ProcessTableHeader(Table table,Cell[][] cells,List<Node> rowshead,int headrowscount,int num_of_columns){
  for (int j=0; j < headrowscount; j++) {
    Statistics.addHeaderRow();
    table.stat.AddHeaderRow();
    List<Node> tds=getChildrenByTagName(rowshead.get(j),"String_Node_Str");
    if (tds.size() == 0)     tds=getChildrenByTagName(rowshead.get(j),"String_Node_Str");
    int index=0;
    for (int k=0; k < tds.size(); k++) {
      boolean is_colspanning=false;
      boolean is_rowspanning=false;
      int colspanVal=1;
      int rowspanVal=1;
      if (tds.get(k).getAttributes().getNamedItem("String_Node_Str") != null && Utilities.isNumeric(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) && Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) > 1) {
        table.setRowSpanning(true);
        Statistics.addRowSpanningCell();
        table.stat.AddRowSpanningCell();
        is_rowspanning=true;
        rowspanVal=Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue());
      }
      if (tds.get(k).getAttributes().getNamedItem("String_Node_Str") != null && Utilities.isNumeric(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) && Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue()) > 1) {
        table.setColSpanning(true);
        Statistics.addColumnSpanningCell();
        table.stat.AddColSpanningCell();
        is_colspanning=true;
        colspanVal=Integer.parseInt(tds.get(k).getAttributes().getNamedItem("String_Node_Str").getNodeValue());
      }
      for (int l=0; l < colspanVal; l++) {
        int rowindex=j;
        for (int s=0; s < rowspanVal; s++) {
          try {
            while (cells[rowindex][index].isIs_filled() && index != num_of_columns)             index++;
            cells[rowindex][index]=Cell.setCellValues(cells[rowindex][index],Utilities.getString(tds.get(k)),is_colspanning,colspanVal,is_rowspanning,rowspanVal,true,1,false,0,index,rowindex,l,s);
            table=Statistics.statisticsForCell(table,cells[rowindex][index]);
          }
 catch (          Exception ex) {
            System.out.println("String_Node_Str");
          }
          rowindex++;
        }
        index++;
      }
    }
  }
  return table;
}