Program: 72880
Project: 72880
Buggy source:
public void startForeign(IForeignContent foreign){
  IStyle mergedStyle=foreign.getStyle();
  logger.log(Level.FINE,"String_Node_Str");
  boolean isTemplate=false;
  Object genBy=foreign.getGenerateBy();
  if (genBy instanceof TemplateDesign) {
    isTemplate=true;
    setupTemplateElement((TemplateDesign)genBy,foreign);
    writer.openTag(HTMLTags.TAG_DIV);
    writer.attribute(HTMLTags.ATTR_ALIGN,"String_Node_Str");
  }
  DimensionType x=foreign.getX();
  DimensionType y=foreign.getY();
  DimensionType width=foreign.getWidth();
  DimensionType height=foreign.getHeight();
  int display;
  display=getElementType(x,y,width,height,mergedStyle);
  String tagName;
  boolean metadataOutput=false;
  if (enableMetadata) {
    metadataOutput=metadataEmitter.startForeign(foreign,HTMLEmitterUtil.getTagByType(display,DISPLAY_FLAG_ALL));
  }
  tagName=openTagByType(display,DISPLAY_FLAG_ALL);
  String styleClass=foreign.getStyleClass();
  setStyleName(styleClass);
  if (!metadataOutput) {
    outputBookmark(foreign,tagName);
  }
  writer.attribute(HTMLTags.ATTR_TITLE,foreign.getHelpText());
  StringBuffer styleBuffer=new StringBuffer();
  htmlEmitter.buildForeignStyle(foreign,styleBuffer,display);
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  String rawType=foreign.getRawType();
  boolean isHtml=IForeignContent.HTML_TYPE.equalsIgnoreCase(rawType);
  if (isHtml) {
    htmlEmitter.handleVerticalAlignBegin(foreign);
    String url=validate(foreign.getHyperlinkAction());
    if (url != null) {
      outputAction(foreign.getHyperlinkAction(),url);
      outputHtmlText(foreign);
      writer.closeTag(HTMLTags.TAG_A);
    }
 else {
      outputHtmlText(foreign);
    }
    htmlEmitter.handleVerticalAlignEnd(foreign);
  }
  writer.closeTag(tagName);
  if (enableMetadata) {
    metadataEmitter.endForeign(foreign);
  }
  if (isTemplate) {
    writer.closeTag(HTMLTags.TAG_DIV);
  }
}

Fixed version (ground truth):
public void startForeign(IForeignContent foreign){
  IStyle mergedStyle=foreign.getStyle();
  logger.log(Level.FINE,"String_Node_Str");
  boolean isTemplate=false;
  Object genBy=foreign.getGenerateBy();
  if (genBy instanceof TemplateDesign) {
    isTemplate=true;
    setupTemplateElement((TemplateDesign)genBy,foreign);
    writer.openTag(HTMLTags.TAG_DIV);
    writer.attribute(HTMLTags.ATTR_ALIGN,"String_Node_Str");
  }
  DimensionType x=foreign.getX();
  DimensionType y=foreign.getY();
  DimensionType width=foreign.getWidth();
  DimensionType height=foreign.getHeight();
  int display;
  display=getElementType(x,y,width,height,mergedStyle);
  String tagName;
  boolean metadataOutput=false;
  if (enableMetadata) {
    metadataOutput=metadataEmitter.startForeign(foreign,HTMLEmitterUtil.getTagByType(display,DISPLAY_FLAG_ALL));
  }
  tagName=openTagByType(display,DISPLAY_FLAG_ALL);
  String styleClass=foreign.getStyleClass();
  setStyleName(styleClass,foreign);
  if (!metadataOutput) {
    outputBookmark(foreign,tagName);
  }
  writer.attribute(HTMLTags.ATTR_TITLE,foreign.getHelpText());
  StringBuffer styleBuffer=new StringBuffer();
  htmlEmitter.buildForeignStyle(foreign,styleBuffer,display);
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  String rawType=foreign.getRawType();
  boolean isHtml=IForeignContent.HTML_TYPE.equalsIgnoreCase(rawType);
  if (isHtml) {
    htmlEmitter.handleVerticalAlignBegin(foreign);
    String url=validate(foreign.getHyperlinkAction());
    if (url != null) {
      outputAction(foreign.getHyperlinkAction(),url);
      outputHtmlText(foreign);
      writer.closeTag(HTMLTags.TAG_A);
    }
 else {
      outputHtmlText(foreign);
    }
    htmlEmitter.handleVerticalAlignEnd(foreign);
  }
  writer.closeTag(tagName);
  if (enableMetadata) {
    metadataEmitter.endForeign(foreign);
  }
  if (isTemplate) {
    writer.closeTag(HTMLTags.TAG_DIV);
  }
}