Program: 143579
Project: 143579
Buggy source:
@SuppressWarnings("String_Node_Str") protected static String instrumentBodyText(Component component,CharSequence bodyText,int halign,int valign,boolean hasHtmlOrImage,Border border,Insets margin,String cssid,char mnemonic,String elementID,String imgURL,int height,boolean isButton,Cursor bodyCursor,boolean isAnchored,int anchors){
  boolean isElementAnchored=anchors != IAnchorConstants.DEFAULT;
  Insets padding=null;
  Insets borderMargin=null;
  boolean usePadding=false;
  if (border == null) {
    padding=margin;
  }
 else   if (border instanceof EmptyBorder) {
    usePadding=true;
    padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(border);
  }
 else   if (border instanceof CompoundBorder) {
    Border inside=((CompoundBorder)border).getInsideBorder();
    if (inside instanceof EmptyBorder) {
      usePadding=true;
      padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(inside);
    }
    Border outside=((CompoundBorder)border).getOutsideBorder();
    if (outside != null) {
      borderMargin=ComponentFactoryHelper.getBorderInsetsForNoComponent(outside);
    }
  }
 else   if (!(border instanceof BevelBorder) && !(border instanceof EtchedBorder)) {
    if (border instanceof TitledBorder) {
      usePadding=true;
      padding=new Insets(5,7,5,7);
      padding.top+=ComponentFactoryHelper.getTitledBorderHeight(border);
    }
 else {
      padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(border);
    }
  }
  StringBuffer instrumentedBodyText=new StringBuffer();
  String displayMode=component instanceof WebDataHtmlView ? "String_Node_Str" : "String_Node_Str";
  instrumentedBodyText.append("String_Node_Str" + (bodyCursor == null ? "String_Node_Str" : "String_Node_Str" + (bodyCursor.getType() == Cursor.HAND_CURSOR ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str") + "String_Node_Str"+ displayMode+ "String_Node_Str");
  int top=0;
  int bottom=0;
  int left=0;
  int right=0;
  if (padding != null && usePadding) {
    top=padding.top;
    bottom=padding.bottom;
    left=padding.left;
    right=padding.right;
  }
  instrumentedBodyText.append("String_Node_Str" + left + "String_Node_Str");
  instrumentedBodyText.append("String_Node_Str" + right + "String_Node_Str");
  if (halign == ISupportTextSetup.LEFT)   instrumentedBodyText.append("String_Node_Str");
 else   if (halign == ISupportTextSetup.RIGHT)   instrumentedBodyText.append("String_Node_Str");
 else   instrumentedBodyText.append("String_Node_Str");
  if (cssid == null) {
    if (valign == ISupportTextSetup.TOP)     instrumentedBodyText.append("String_Node_Str" + top + "String_Node_Str");
 else     if (valign == ISupportTextSetup.BOTTOM)     instrumentedBodyText.append("String_Node_Str" + bottom + "String_Node_Str");
  }
  if (!hasHtmlOrImage)   instrumentedBodyText.append("String_Node_Str");
  if (hasHtmlOrImage && valign != ISupportTextSetup.CENTER && cssid == null)   instrumentedBodyText.append("String_Node_Str");
 else   if ((cssid != null) || (valign != ISupportTextSetup.CENTER))   instrumentedBodyText.append("String_Node_Str");
 else   if (!isButton && !hasHtmlOrImage && imgURL == null) {
    int innerHeight=height;
    if (padding != null)     innerHeight-=padding.top + padding.bottom;
    if (borderMargin != null)     innerHeight-=borderMargin.top + borderMargin.bottom;
    instrumentedBodyText.append("String_Node_Str" + innerHeight + "String_Node_Str");
  }
  if (isAnchored) {
    instrumentedBodyText.append("String_Node_Str");
  }
  if (cssid != null) {
    instrumentedBodyText.append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (cssid != null) {
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(cssid);
    instrumentedBodyText.append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (!Strings.isEmpty(bodyText)) {
    CharSequence bodyTextValue=bodyText;
    if (mnemonic > 0 && !hasHtmlOrImage) {
      StringBuffer sbBodyText=new StringBuffer(bodyTextValue);
      int mnemonicIdx=sbBodyText.indexOf(Character.toString(mnemonic));
      if (mnemonicIdx != -1) {
        sbBodyText.insert(mnemonicIdx + 1,"String_Node_Str");
        sbBodyText.insert(mnemonicIdx,"String_Node_Str");
        bodyTextValue=sbBodyText.toString();
      }
    }
    if (imgURL != null) {
      String onLoadCall=isElementAnchored ? "String_Node_Str" + elementID + "String_Node_Str"+ valign+ "String_Node_Str" : "String_Node_Str";
      StringBuffer sb=new StringBuffer("String_Node_Str").append(elementID).append("String_Node_Str").append("String_Node_Str").append(imgURL).append("String_Node_Str" + (isElementAnchored ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str").append(onLoadCall).append("String_Node_Str").append(bodyTextValue);
      bodyTextValue=sb.toString();
    }
    instrumentedBodyText.append(bodyTextValue);
  }
 else   if (imgURL != null) {
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(elementID).append("String_Node_Str");
    instrumentedBodyText.append(isElementAnchored ? "String_Node_Str" : "String_Node_Str");
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(imgURL);
    String onLoadCall=isElementAnchored ? "String_Node_Str" + elementID + "String_Node_Str"+ valign+ "String_Node_Str" : "String_Node_Str";
    instrumentedBodyText.append("String_Node_Str").append(onLoadCall).append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (border instanceof TitledBorder) {
    instrumentedBodyText=new StringBuffer(getTitledBorderOpenMarkup((TitledBorder)border) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup());
  }
  if (border instanceof CompoundBorder) {
    Border outside=((CompoundBorder)border).getOutsideBorder();
    if (outside != null && outside instanceof TitledBorder) {
      instrumentedBodyText=new StringBuffer(getTitledBorderOpenMarkup((TitledBorder)outside) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup());
    }
  }
  return instrumentedBodyText.toString();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected static String instrumentBodyText(CharSequence bodyText,int halign,int valign,boolean hasHtmlOrImage,Border border,Insets margin,String cssid,char mnemonic,String elementID,String imgURL,int height,boolean isButton,Cursor bodyCursor,boolean isAnchored,int anchors){
  boolean isElementAnchored=anchors != IAnchorConstants.DEFAULT;
  Insets padding=null;
  Insets borderMargin=null;
  boolean usePadding=false;
  if (border == null) {
    padding=margin;
  }
 else   if (border instanceof EmptyBorder && !(border instanceof MatteBorder)) {
    usePadding=true;
    padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(border);
  }
 else   if (border instanceof CompoundBorder) {
    Border inside=((CompoundBorder)border).getInsideBorder();
    if (inside instanceof EmptyBorder && !(border instanceof MatteBorder)) {
      usePadding=true;
      padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(inside);
    }
    Border outside=((CompoundBorder)border).getOutsideBorder();
    if (outside != null) {
      borderMargin=ComponentFactoryHelper.getBorderInsetsForNoComponent(outside);
    }
  }
 else   if (!(border instanceof BevelBorder) && !(border instanceof EtchedBorder)) {
    if (border instanceof TitledBorder) {
      usePadding=true;
      padding=new Insets(5,7,5,7);
      padding.top+=ComponentFactoryHelper.getTitledBorderHeight(border);
    }
 else {
      padding=ComponentFactoryHelper.getBorderInsetsForNoComponent(border);
    }
  }
  StringBuffer instrumentedBodyText=new StringBuffer();
  instrumentedBodyText.append("String_Node_Str" + (bodyCursor == null ? "String_Node_Str" : "String_Node_Str" + (bodyCursor.getType() == Cursor.HAND_CURSOR ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str") + "String_Node_Str");
  int top=0;
  int bottom=0;
  int left=0;
  int right=0;
  if (padding != null && usePadding) {
    top=padding.top;
    bottom=padding.bottom;
    left=padding.left;
    right=padding.right;
  }
  instrumentedBodyText.append("String_Node_Str" + left + "String_Node_Str");
  instrumentedBodyText.append("String_Node_Str" + right + "String_Node_Str");
  if (halign == ISupportTextSetup.LEFT)   instrumentedBodyText.append("String_Node_Str");
 else   if (halign == ISupportTextSetup.RIGHT)   instrumentedBodyText.append("String_Node_Str");
 else   instrumentedBodyText.append("String_Node_Str");
  if (cssid == null) {
    if (valign == ISupportTextSetup.TOP)     instrumentedBodyText.append("String_Node_Str" + top + "String_Node_Str");
 else     if (valign == ISupportTextSetup.BOTTOM)     instrumentedBodyText.append("String_Node_Str" + bottom + "String_Node_Str");
  }
  if (!hasHtmlOrImage)   instrumentedBodyText.append("String_Node_Str");
  if (hasHtmlOrImage && valign != ISupportTextSetup.CENTER && cssid == null)   instrumentedBodyText.append("String_Node_Str");
 else   if ((cssid != null) || (valign != ISupportTextSetup.CENTER))   instrumentedBodyText.append("String_Node_Str");
 else   if (!isButton && !hasHtmlOrImage && imgURL == null) {
    int innerHeight=height;
    if (padding != null)     innerHeight-=padding.top + padding.bottom;
    if (borderMargin != null)     innerHeight-=borderMargin.top + borderMargin.bottom;
    instrumentedBodyText.append("String_Node_Str" + innerHeight + "String_Node_Str");
  }
  if (isAnchored) {
    instrumentedBodyText.append("String_Node_Str");
  }
  if (cssid != null) {
    instrumentedBodyText.append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (cssid != null) {
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(cssid);
    instrumentedBodyText.append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (!Strings.isEmpty(bodyText)) {
    CharSequence bodyTextValue=bodyText;
    if (mnemonic > 0 && !hasHtmlOrImage) {
      StringBuffer sbBodyText=new StringBuffer(bodyTextValue);
      int mnemonicIdx=sbBodyText.indexOf(Character.toString(mnemonic));
      if (mnemonicIdx != -1) {
        sbBodyText.insert(mnemonicIdx + 1,"String_Node_Str");
        sbBodyText.insert(mnemonicIdx,"String_Node_Str");
        bodyTextValue=sbBodyText.toString();
      }
    }
    if (imgURL != null) {
      String onLoadCall=isElementAnchored ? "String_Node_Str" + elementID + "String_Node_Str"+ valign+ "String_Node_Str" : "String_Node_Str";
      StringBuffer sb=new StringBuffer("String_Node_Str").append(elementID).append("String_Node_Str").append("String_Node_Str").append(imgURL).append("String_Node_Str" + (isElementAnchored ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str").append(onLoadCall).append("String_Node_Str").append(bodyTextValue);
      bodyTextValue=sb.toString();
    }
    instrumentedBodyText.append(bodyTextValue);
  }
 else   if (imgURL != null) {
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(elementID).append("String_Node_Str");
    instrumentedBodyText.append(isElementAnchored ? "String_Node_Str" : "String_Node_Str");
    instrumentedBodyText.append("String_Node_Str");
    instrumentedBodyText.append(imgURL);
    String onLoadCall=isElementAnchored ? "String_Node_Str" + elementID + "String_Node_Str"+ valign+ "String_Node_Str" : "String_Node_Str";
    instrumentedBodyText.append("String_Node_Str").append(onLoadCall).append("String_Node_Str");
  }
  instrumentedBodyText.append("String_Node_Str");
  if (border instanceof TitledBorder) {
    instrumentedBodyText=new StringBuffer(getTitledBorderOpenMarkup((TitledBorder)border) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup());
  }
  if (border instanceof CompoundBorder) {
    Border outside=((CompoundBorder)border).getOutsideBorder();
    if (outside != null && outside instanceof TitledBorder) {
      instrumentedBodyText=new StringBuffer(getTitledBorderOpenMarkup((TitledBorder)outside) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup());
    }
  }
  return instrumentedBodyText.toString();
}