Program: 72294
Project: 72294
Buggy source:
/** 
 * The page layout is controlled by three render options: <ul> <li>OUTPUT-MASTER-PAGE</li> <li>OUTPUT-MARGIN</li> <li>FLOATING-FOOTER</li> </ul> The layout effect matrix are demostrate in following table: <table border="all"> <tr> <th>PAGE</th> <th>MARGIN</th> <th>FOOTER</th> <th>effect</th> </tr> <tr valign="top"> <td rowspan="4">TRUE</td> <td rowspan="2">TRUE</td> <td >FALSE</td> <td> <table border="all" style="width:2in;height:2in;"> <col width="0.3in"/> <col width="100%"/> <col width="0.3in"/> <tr style="height:0.2in;"> <td colspan="3">top-margin</td> </tr> <tr> <td>LM</td> <td valign="top">header</td> <td>RM</td> </tr> <tr style="height:100%"> <td>LM</td> <td><div>body</div></td> <td>RM</td> </tr> <tr> <td>LM</td> <td><div>footer</div></td> <td>RM</td> </tr> <tr style="height:0.2in" > <td colspan="3"><div>bottom-margin</div></td> </tr> <table> </td> </table> <tr valign="top"> <td>TRUE</td> <td> <table border="all" style="width:2in;"> <col width="0.3in"/> <col width="100%"/> <col width="0.3in"/> <tr style="height:0.2in;"> <td colspan="3">top-margin</td> </tr> <tr> <td >LM</td> <td valign="top"><div>header</div></td> <td >RM</td> </tr> <tr> <td>LM</td> <td><div>body</div></td> <td>RM</td> </tr> <tr style="height:100%"> <td>LM</td> <td valign="top"><div>footer</div></td> <td>RM</td> </tr> <tr style="height:0.2in" > <td colspan="3"><div>bottom-margin</div></td> </tr> </table> </td> </tr> <tr valign="top"> <td rowspan="2">FALSE</td> <td>TRUE</td> <td> <table border="all" style="width:1.6in;height:1in;"> <col/> <tr> <td valign="top"><div>header</div></td> </tr> <tr style="height:100%"> <td><div>body</div></td> </tr> <tr> <td><div>footer</div></td> </tr> </table> </td> </tr> <tr> <td>FALSE</td> <td> <table border="all" style="width:1.6in;"> <col/> <tr> <td valign="top"><div>header</div></td> </tr> <tr> <td><div>body</div></td> </tr> <tr> <td><div>footer</div></td> </tr> </table> </td> </tr> <tr> <td>FALSE</td> <td>ANY</td> <td>ANY</td> <td> <table border="all" style="width:1.6in;"> <tr> <td>BODY</td> </tr> </table> </td> </tr> </table>
 */
public void startPage(IPageContent page){
  pageNo++;
  if (pageNo > 1 && outputMasterPageContent == false) {
    writer.openTag("String_Node_Str");
    writer.closeTag("String_Node_Str");
  }
  boolean fixedReport=HTMLRenderOption.LAYOUT_PREFERENCE_FIXED.equals(layoutPreference);
  StringBuffer styleBuffer=new StringBuffer();
  writer.openTag(HTMLTags.TAG_TABLE);
  writer.attribute("String_Node_Str","String_Node_Str");
  styleBuffer.append("String_Node_Str");
  if (pageNo > 1) {
    styleBuffer.append("String_Node_Str");
  }
  if (page != null && outputMasterPageContent) {
    htmlEmitter.buildPageStyle(page,styleBuffer);
    if (fixedReport) {
      DimensionType width=getPageWidth(page);
      if (width != null) {
        styleBuffer.append("String_Node_Str");
        styleBuffer.append(width.toString());
        styleBuffer.append("String_Node_Str");
      }
    }
 else {
      styleBuffer.append("String_Node_Str");
    }
    if (!pageFooterFloatFlag) {
      DimensionType height=getPageHeight(page);
      if (height != null) {
        styleBuffer.append("String_Node_Str");
        styleBuffer.append(height.toString());
        styleBuffer.append("String_Node_Str");
      }
    }
    if (fixedReport) {
      styleBuffer.append("String_Node_Str");
      styleBuffer.append("String_Node_Str");
    }
  }
 else {
    styleBuffer.append("String_Node_Str");
  }
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  if (page != null && outputMasterPageContent) {
    if (outputMasterPageMargins) {
      outputColumn(page.getMarginLeft());
    }
    writer.openTag(HTMLTags.TAG_COL);
    writer.closeTag(HTMLTags.TAG_COL);
    if (outputMasterPageMargins) {
      outputColumn(page.getMarginLeft());
      outputVMargin(page.getMarginTop());
    }
    if (showPageHeader(page)) {
      writer.openTag(HTMLTags.TAG_TR);
      if (outputMasterPageMargins) {
        outputHMargin(page.getMarginLeft());
      }
      outputPageBand(page,page.getPageHeader());
      if (outputMasterPageMargins) {
        outputHMargin(page.getMarginRight());
      }
      writer.closeTag(HTMLTags.TAG_TR);
    }
  }
  writer.openTag(HTMLTags.TAG_TR);
  if (!pageFooterFloatFlag) {
    writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  }
  if (page != null && outputMasterPageContent && outputMasterPageMargins) {
    outputHMargin(page.getMarginLeft());
  }
  writer.openTag(HTMLTags.TAG_TD);
  writer.attribute("String_Node_Str","String_Node_Str");
  if (htmlRtLFlag) {
    writer.attribute(HTMLTags.ATTR_HTML_DIR,CSSConstants.CSS_RTL_VALUE);
  }
}

Fixed version (ground truth):
/** 
 * The page layout is controlled by three render options: <ul> <li>OUTPUT-MASTER-PAGE</li> <li>OUTPUT-MARGIN</li> <li>FLOATING-FOOTER</li> </ul> The layout effect matrix are demostrate in following table: <table border="all"> <tr> <th>PAGE</th> <th>MARGIN</th> <th>FOOTER</th> <th>effect</th> </tr> <tr valign="top"> <td rowspan="4">TRUE</td> <td rowspan="2">TRUE</td> <td >FALSE</td> <td> <table border="all" style="width:2in;height:2in;"> <col width="0.3in"/> <col width="100%"/> <col width="0.3in"/> <tr style="height:0.2in;"> <td colspan="3">top-margin</td> </tr> <tr> <td>LM</td> <td valign="top">header</td> <td>RM</td> </tr> <tr style="height:100%"> <td>LM</td> <td><div>body</div></td> <td>RM</td> </tr> <tr> <td>LM</td> <td><div>footer</div></td> <td>RM</td> </tr> <tr style="height:0.2in" > <td colspan="3"><div>bottom-margin</div></td> </tr> <table> </td> </table> <tr valign="top"> <td>TRUE</td> <td> <table border="all" style="width:2in;"> <col width="0.3in"/> <col width="100%"/> <col width="0.3in"/> <tr style="height:0.2in;"> <td colspan="3">top-margin</td> </tr> <tr> <td >LM</td> <td valign="top"><div>header</div></td> <td >RM</td> </tr> <tr> <td>LM</td> <td><div>body</div></td> <td>RM</td> </tr> <tr style="height:100%"> <td>LM</td> <td valign="top"><div>footer</div></td> <td>RM</td> </tr> <tr style="height:0.2in" > <td colspan="3"><div>bottom-margin</div></td> </tr> </table> </td> </tr> <tr valign="top"> <td rowspan="2">FALSE</td> <td>TRUE</td> <td> <table border="all" style="width:1.6in;height:1in;"> <col/> <tr> <td valign="top"><div>header</div></td> </tr> <tr style="height:100%"> <td><div>body</div></td> </tr> <tr> <td><div>footer</div></td> </tr> </table> </td> </tr> <tr> <td>FALSE</td> <td> <table border="all" style="width:1.6in;"> <col/> <tr> <td valign="top"><div>header</div></td> </tr> <tr> <td><div>body</div></td> </tr> <tr> <td><div>footer</div></td> </tr> </table> </td> </tr> <tr> <td>FALSE</td> <td>ANY</td> <td>ANY</td> <td> <table border="all" style="width:1.6in;"> <tr> <td>BODY</td> </tr> </table> </td> </tr> </table>
 */
public void startPage(IPageContent page){
  pageNo++;
  if (pageNo > 1 && outputMasterPageContent == false) {
    writer.openTag("String_Node_Str");
    writer.closeTag("String_Node_Str");
  }
  if (pageNo > 1) {
    writer.writeCode("String_Node_Str");
  }
  boolean fixedReport=HTMLRenderOption.LAYOUT_PREFERENCE_FIXED.equals(layoutPreference);
  StringBuffer styleBuffer=new StringBuffer();
  writer.openTag(HTMLTags.TAG_TABLE);
  writer.attribute("String_Node_Str","String_Node_Str");
  styleBuffer.append("String_Node_Str");
  if (page != null && outputMasterPageContent) {
    htmlEmitter.buildPageStyle(page,styleBuffer);
    if (fixedReport) {
      DimensionType width=getPageWidth(page);
      if (width != null) {
        styleBuffer.append("String_Node_Str");
        styleBuffer.append(width.toString());
        styleBuffer.append("String_Node_Str");
      }
    }
 else {
      styleBuffer.append("String_Node_Str");
    }
    if (!pageFooterFloatFlag) {
      DimensionType height=getPageHeight(page);
      if (height != null) {
        styleBuffer.append("String_Node_Str");
        styleBuffer.append(height.toString());
        styleBuffer.append("String_Node_Str");
      }
    }
    if (fixedReport) {
      styleBuffer.append("String_Node_Str");
      styleBuffer.append("String_Node_Str");
    }
  }
 else {
    styleBuffer.append("String_Node_Str");
  }
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  if (page != null && outputMasterPageContent) {
    if (outputMasterPageMargins) {
      outputColumn(page.getMarginLeft());
    }
    writer.openTag(HTMLTags.TAG_COL);
    writer.closeTag(HTMLTags.TAG_COL);
    if (outputMasterPageMargins) {
      outputColumn(page.getMarginLeft());
      outputVMargin(page.getMarginTop());
    }
    if (showPageHeader(page)) {
      writer.openTag(HTMLTags.TAG_TR);
      if (outputMasterPageMargins) {
        outputHMargin(page.getMarginLeft());
      }
      outputPageBand(page,page.getPageHeader());
      if (outputMasterPageMargins) {
        outputHMargin(page.getMarginRight());
      }
      writer.closeTag(HTMLTags.TAG_TR);
    }
  }
  writer.openTag(HTMLTags.TAG_TR);
  if (!pageFooterFloatFlag) {
    writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
  }
  if (page != null && outputMasterPageContent && outputMasterPageMargins) {
    outputHMargin(page.getMarginLeft());
  }
  writer.openTag(HTMLTags.TAG_TD);
  writer.attribute("String_Node_Str","String_Node_Str");
  if (htmlRtLFlag) {
    writer.attribute(HTMLTags.ATTR_HTML_DIR,CSSConstants.CSS_RTL_VALUE);
  }
}