Program: 76329
Project: 76329
Buggy source:
public void startForeign(IForeignContent foreign){
  IStyle mergedStyle=foreign.getStyle();
  if (peek(mergedStyle)) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  resizeTemplateElement(foreign);
  StringBuffer styleBuffer=new StringBuffer();
  DimensionType x=foreign.getX();
  DimensionType y=foreign.getY();
  DimensionType width=foreign.getWidth();
  DimensionType height=foreign.getHeight();
  int display;
  display=checkElementType(x,y,width,height,mergedStyle,styleBuffer);
  if (foreign.getGenerateBy() instanceof TemplateDesign) {
    String bookmark=foreign.getBookmark();
    if (bookmark == null) {
      bookmark=idGenerator.generateUniqueID();
      foreign.setBookmark(bookmark);
    }
  }
  String tagName;
  String url=validate(foreign.getHyperlinkAction());
  boolean metadataOutput=false;
  if (url != null) {
    if (enableMetadata) {
      metadataOutput=metadataEmitter.startForeign(foreign,HTMLTags.TAG_SPAN);
    }
    tagName=HTMLTags.TAG_A;
    outputAction(foreign.getHyperlinkAction(),url);
    setDisplayProperty(display,DISPLAY_BLOCK | DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(mergedStyle,styleBuffer);
  }
 else {
    if (enableMetadata) {
      metadataOutput=metadataEmitter.startForeign(foreign,HTMLEmitterUtil.getTagByType(display,DISPLAY_FLAG_ALL));
    }
    tagName=openTagByType(display,DISPLAY_FLAG_ALL);
    setDisplayProperty(display,DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  setStyleName(foreign.getStyleClass());
  if (!metadataOutput) {
    outputBookmark(foreign,tagName);
  }
  writer.attribute(HTMLTags.ATTR_TITLE,foreign.getHelpText());
  if (isTalbeTemplateElement(foreign)) {
    mergedStyle.setProperty(IStyle.STYLE_BORDER_TOP_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_LEFT_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_RIGHT_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_FONT_FAMILY,IStyle.SANS_SERIF_VALUE);
  }
  String textAlign=foreign.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  handleShrink(display,mergedStyle,height,width,styleBuffer);
  handleStyle(foreign,styleBuffer,false);
  String rawType=foreign.getRawType();
  boolean isHtml=IForeignContent.HTML_TYPE.equalsIgnoreCase(rawType);
  if (isHtml) {
    CSSValue vAlign=mergedStyle.getProperty(IStyle.STYLE_VERTICAL_ALIGN);
    if (vAlign != null && vAlign != IStyle.BASELINE_VALUE && height != null) {
      writer.openTag(HTMLTags.TAG_TABLE);
      writer.attribute(HTMLTags.ATTR_STYLE,"String_Node_Str");
      writer.openTag(HTMLTags.TAG_TR);
      writer.openTag(HTMLTags.TAG_TD);
      StringBuffer textStyleBuffer=new StringBuffer();
      textStyleBuffer.append("String_Node_Str");
      textStyleBuffer.append(vAlign.getCssText());
      textStyleBuffer.append("String_Node_Str");
      writer.attribute(HTMLTags.ATTR_STYLE,textStyleBuffer);
      outputHtmlText(foreign);
      writer.closeTag(HTMLTags.TAG_TD);
      writer.closeTag(HTMLTags.TAG_TR);
      writer.closeTag(HTMLTags.TAG_TABLE);
    }
 else {
      outputHtmlText(foreign);
    }
  }
  writer.closeTag(tagName);
  if (enableMetadata) {
    metadataEmitter.endForeign(foreign);
  }
  cellFilled=true;
}

Fixed version (ground truth):
public void startForeign(IForeignContent foreign){
  IStyle mergedStyle=foreign.getStyle();
  if (peek(mergedStyle)) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  resizeTemplateElement(foreign);
  StringBuffer styleBuffer=new StringBuffer();
  DimensionType x=foreign.getX();
  DimensionType y=foreign.getY();
  DimensionType width=foreign.getWidth();
  DimensionType height=foreign.getHeight();
  int display;
  display=checkElementType(x,y,width,height,mergedStyle,styleBuffer);
  if (foreign.getGenerateBy() instanceof TemplateDesign) {
    String bookmark=foreign.getBookmark();
    if (bookmark == null) {
      bookmark=idGenerator.generateUniqueID();
      foreign.setBookmark(bookmark);
    }
  }
  String tagName;
  String url=validate(foreign.getHyperlinkAction());
  boolean metadataOutput=false;
  if (url != null) {
    if (enableMetadata) {
      metadataOutput=metadataEmitter.startForeign(foreign,HTMLTags.TAG_SPAN);
    }
    tagName=HTMLTags.TAG_A;
    outputAction(foreign.getHyperlinkAction(),url);
    setDisplayProperty(display,DISPLAY_BLOCK | DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(mergedStyle,styleBuffer);
  }
 else {
    if (enableMetadata) {
      metadataOutput=metadataEmitter.startForeign(foreign,HTMLEmitterUtil.getTagByType(display,DISPLAY_FLAG_ALL));
    }
    tagName=openTagByType(display,DISPLAY_FLAG_ALL);
    setDisplayProperty(display,DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  setStyleName(foreign.getStyleClass());
  if (!metadataOutput) {
    outputBookmark(foreign,tagName);
  }
  writer.attribute(HTMLTags.ATTR_TITLE,foreign.getHelpText());
  if (isTalbeTemplateElement(foreign)) {
    mergedStyle.setProperty(IStyle.STYLE_BORDER_TOP_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_LEFT_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_BORDER_RIGHT_STYLE,IStyle.DOTTED_VALUE);
    mergedStyle.setProperty(IStyle.STYLE_FONT_FAMILY,IStyle.SANS_SERIF_VALUE);
  }
  String textAlign=foreign.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  handleShrink(display,mergedStyle,height,width,styleBuffer);
  handleStyle(foreign,styleBuffer,false);
  String rawType=foreign.getRawType();
  boolean isHtml=IForeignContent.HTML_TYPE.equalsIgnoreCase(rawType);
  if (isHtml) {
    CSSValue vAlign=mergedStyle.getProperty(IStyle.STYLE_VERTICAL_ALIGN);
    if (vAlign != null && vAlign != IStyle.BASELINE_VALUE && height != null) {
      writer.openTag(HTMLTags.TAG_TABLE);
      StringBuffer nestingTableStyleBuffer=new StringBuffer();
      nestingTableStyleBuffer.append("String_Node_Str");
      nestingTableStyleBuffer.append(height.toString());
      writer.attribute(HTMLTags.ATTR_STYLE,nestingTableStyleBuffer);
      writer.openTag(HTMLTags.TAG_TR);
      writer.openTag(HTMLTags.TAG_TD);
      StringBuffer textStyleBuffer=new StringBuffer();
      textStyleBuffer.append("String_Node_Str");
      textStyleBuffer.append(vAlign.getCssText());
      textStyleBuffer.append("String_Node_Str");
      writer.attribute(HTMLTags.ATTR_STYLE,textStyleBuffer);
      outputHtmlText(foreign);
      writer.closeTag(HTMLTags.TAG_TD);
      writer.closeTag(HTMLTags.TAG_TR);
      writer.closeTag(HTMLTags.TAG_TABLE);
    }
 else {
      outputHtmlText(foreign);
    }
  }
  writer.closeTag(tagName);
  if (enableMetadata) {
    metadataEmitter.endForeign(foreign);
  }
  cellFilled=true;
}