Program: 36959
Project: 36959
Buggy source:
/** 
 * Process list table. List table is a table that forms data in a list. It can have multiple columns for space saving, but generally it is one dimensional list
 * @param cells the table object. 2 dimensional array of Cell object
 * @param table Table object
 * @param art the Article object
 * @param tableFileName the table file name
 */
public Table processListTable(Cell[][] cells,Table table,Article art,String tableFileName){
  if (cells == null || cells.length == 0 || cells[0] == null || cells[0].length == 0)   return table;
  if (table.getTableStructureType() != Table.StructureType.LIST && table.getTableStructureType() != null) {
    return table;
  }
  if (isListTable(cells,table)) {
    Statistics.addListTable();
    table.setTableStructureType(Table.StructureType.LIST);
    if (TablInExMain.ExportLinkedData) {
      TablInExMain.linkedData.AddTable(table.getTable_title(),table.getTable_caption(),"String_Node_Str","String_Node_Str",table.getTable_footer(),table.getXml());
    }
    boolean hasSubheaders=hasSuperRowsListTable(cells,table);
    boolean TopLevel=false;
    String currentSubHeader="String_Node_Str";
    for (int j=0; j < cells.length; j++) {
      for (int k=0; k < cells[j].length; k++) {
        if (cells[j][k].isIs_header())         continue;
        try {
          if (hasSubheaders) {
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && cells[j + 1] != null && Utilities.numOfSpaceOrBullets(cells[j + 1][k].getCell_content()) != 0 && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && (cells[j + 2] != null && Utilities.numOfSpaceOrBullets(cells[j + 2][k].getCell_content()) != 0) && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
            if (TopLevel == true && !cells[j][k].isBreakingLineOverRow() && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && !currentSubHeader.equals("String_Node_Str")) {
              currentSubHeader=cells[j][k].getCell_content();
              continue;
            }
          }
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          for (int s=0; s < cells[0][k].headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(cells[0][k].headers.get(s));
            NavigationPath.appendChild(Header);
          }
          if (currentSubHeader != "String_Node_Str") {
            Element SubHeader=doc.createElement("String_Node_Str");
            SubHeader.setTextContent(currentSubHeader);
            NavigationPath.appendChild(SubHeader);
          }
          cell.appendChild(NavigationPath);
          cells[j][k].setHeader_values(cells[0][k].getCell_content());
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableA=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableA);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableA.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableA.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableA.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableA.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell("String_Node_Str",null,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),"String_Node_Str",j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
  return table;
}

Fixed version (ground truth):
/** 
 * Process list table. List table is a table that forms data in a list. It can have multiple columns for space saving, but generally it is one dimensional list
 * @param cells the table object. 2 dimensional array of Cell object
 * @param table Table object
 * @param art the Article object
 * @param tableFileName the table file name
 */
public Table processListTable(Cell[][] cells,Table table,Article art,String tableFileName){
  if (cells == null || cells.length == 0 || cells[0] == null || cells[0].length == 0)   return table;
  if (table.getTableStructureType() != Table.StructureType.LIST && table.getTableStructureType() != null) {
    return table;
  }
  if (isListTable(cells,table)) {
    Statistics.addListTable();
    table.setTableStructureType(Table.StructureType.LIST);
    if (TablInExMain.ExportLinkedData) {
      TablInExMain.linkedData.AddTable(table.getTable_title(),table.getTable_caption(),"String_Node_Str","String_Node_Str",table.getTable_footer(),table.getXml());
    }
    boolean hasSubheaders=hasSuperRowsListTable(cells,table);
    boolean TopLevel=false;
    String currentSubHeader="String_Node_Str";
    String SubHeaderIndex="String_Node_Str";
    for (int j=0; j < cells.length; j++) {
      for (int k=0; k < cells[j].length; k++) {
        if (cells[j][k].isIs_header())         continue;
        if (cells[j][k].isIs_stub())         cells[j][k].setIs_stub(false);
        try {
          if (hasSubheaders) {
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && cells[j + 1] != null && Utilities.numOfSpaceOrBullets(cells[j + 1][k].getCell_content()) != 0 && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              cells[j][k].setIs_subheader(true);
              SubHeaderIndex=j + "String_Node_Str" + k;
              continue;
            }
            if (TopLevel == false && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && (cells[j + 2] != null && Utilities.numOfSpaceOrBullets(cells[j + 2][k].getCell_content()) != 0) && currentSubHeader.equals("String_Node_Str")) {
              TopLevel=true;
              currentSubHeader=cells[j][k].getCell_content();
              cells[j][k].setIs_subheader(true);
              SubHeaderIndex=j + "String_Node_Str" + k;
              continue;
            }
            if (TopLevel == true && !cells[j][k].isBreakingLineOverRow() && Utilities.numOfSpaceOrBullets(cells[j][k].getCell_content()) == 0 && !currentSubHeader.equals("String_Node_Str")) {
              currentSubHeader=cells[j][k].getCell_content();
              cells[j][k].setIs_subheader(true);
              SubHeaderIndex=j + "String_Node_Str" + k;
              continue;
            }
          }
          DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
          Document doc=docBuilder.newDocument();
          Element rootElement=doc.createElement("String_Node_Str");
          doc.appendChild(rootElement);
          Element cell=doc.createElement("String_Node_Str");
          rootElement.appendChild(cell);
          Element NavigationPath=doc.createElement("String_Node_Str");
          for (int s=0; s < cells[0][k].headers.size(); s++) {
            Element Header=doc.createElement("String_Node_Str" + s);
            Header.setTextContent(cells[0][k].headers.get(s));
            NavigationPath.appendChild(Header);
          }
          if (currentSubHeader != "String_Node_Str") {
            Element SubHeader=doc.createElement("String_Node_Str");
            SubHeader.setTextContent(currentSubHeader);
            cells[j][k].setSuperRowIndex(SubHeaderIndex);
            NavigationPath.appendChild(SubHeader);
          }
          cell.appendChild(NavigationPath);
          cells[j][k].setHeader_values(cells[0][k].getCell_content());
          Element info=doc.createElement("String_Node_Str");
          info.setTextContent(cells[j][k].getCell_content());
          cell.appendChild(info);
          Element CellType=doc.createElement("String_Node_Str");
          CellType.setTextContent(cells[j][k].getCellType());
          cell.appendChild(CellType);
          Element tableA=doc.createElement("String_Node_Str");
          rootElement.appendChild(tableA);
          Element tname=doc.createElement("String_Node_Str");
          tname.setTextContent(table.getTable_caption());
          tableA.appendChild(tname);
          Element TableType=doc.createElement("String_Node_Str");
          TableType.setTextContent("String_Node_Str");
          tableA.appendChild(TableType);
          Element torder=doc.createElement("String_Node_Str");
          torder.setTextContent(table.getTable_title());
          tableA.appendChild(torder);
          Element tfooter=doc.createElement("String_Node_Str");
          tfooter.setTextContent(table.getTable_footer());
          tableA.appendChild(tfooter);
          Element document=doc.createElement("String_Node_Str");
          rootElement.appendChild(document);
          Element docTitle=doc.createElement("String_Node_Str");
          docTitle.setTextContent(art.getTitle());
          document.appendChild(docTitle);
          Element pmc=doc.createElement("String_Node_Str");
          pmc.setTextContent(art.getPmc());
          document.appendChild(pmc);
          if (TablInExMain.ExportLinkedData) {
            TablInExMain.linkedData.AddCell("String_Node_Str",null,cells[j][k].getCell_content(),cells[j][k].getCellType(),cells[0][k].headers.toArray(new String[0]),"String_Node_Str",j,k);
          }
          DataExtractionOutputObj dataExtObj=new DataExtractionOutputObj(folder + tableFileName + "String_Node_Str"+ j+ "String_Node_Str"+ k+ "String_Node_Str",doc);
          table.output.add(dataExtObj);
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
    }
  }
  table.cells=cells;
  table.original_cells=cells;
  return table;
}