Program: 66393
Project: 66393
Buggy source:
/** 
 * handle the foreign content object. Foreign content can be created by following design element: <li> Text(HTML). It will create a TEMPLATE_TYPE foreign object. <li> MultiLine(HTML). It will create a HTML_TYPE forign object <li> MultiLine(PlainText).It will create a TEXT_TYPE foreign object <li> Extended item. It will create a TEXT_TYPE/HTML_TYPE/IMAGE_TYPE/VALUE_TYPE foreign object.
 */
private IContent localizeForeign(IForeignContent foreignContent){
  IReportContent reportContent=getReportContent();
  String rawFormat=foreignContent.getRawType();
  Object rawValue=foreignContent.getRawValue();
  handleOnRender(foreignContent);
  if (IForeignContent.TEMPLATE_TYPE.equals(rawFormat)) {
    processTemplateContent(foreignContent);
    return foreignContent;
  }
  if (IForeignContent.EXTERNAL_TYPE.equals(rawFormat)) {
    return processExtendedContent(foreignContent);
  }
  if (IForeignContent.IMAGE_TYPE.equals(rawFormat)) {
    if (rawValue instanceof IImageContent) {
      IImageContent image=(IImageContent)rawValue;
      processImage(image);
      return image;
    }
    if (rawValue instanceof byte[]) {
      IImageContent imageContent=reportContent.createImageContent(foreignContent);
      imageContent.setImageSource(IImageContent.IMAGE_EXPRESSION);
      imageContent.setData((byte[])rawValue);
      processImage(imageContent);
      return imageContent;
    }
  }
  if (IForeignContent.TEXT_TYPE.equals(rawFormat)) {
    ITextContent textContent=reportContent.createDataContent(foreignContent);
    textContent.setText(rawValue == null ? "String_Node_Str" : rawValue.toString());
    return textContent;
  }
  if (IForeignContent.HTML_TYPE.equals(rawFormat)) {
    String key=foreignContent.getRawKey();
    if (key != null) {
      String text=localize(foreignContent,key,null);
      if (text != null) {
        foreignContent.setRawValue(text);
      }
    }
 else {
      Object value=foreignContent.getRawValue();
      String text=format(value,foreignContent.getComputedStyle());
      if (text != null) {
        foreignContent.setRawValue(text);
      }
    }
    return foreignContent;
  }
  if (IForeignContent.VALUE_TYPE.equals(rawFormat)) {
    IDataContent dataContent=reportContent.createDataContent(foreignContent);
    dataContent.setParent(foreignContent.getParent());
    dataContent.setValue(rawValue);
    processData(dataContent);
    return dataContent;
  }
  return foreignContent;
}

Fixed version (ground truth):
/** 
 * handle the foreign content object. Foreign content can be created by following design element: <li> Text(HTML). It will create a TEMPLATE_TYPE foreign object. <li> MultiLine(HTML). It will create a HTML_TYPE forign object <li> MultiLine(PlainText).It will create a TEXT_TYPE foreign object <li> Extended item. It will create a TEXT_TYPE/HTML_TYPE/IMAGE_TYPE/VALUE_TYPE foreign object.
 */
private IContent localizeForeign(IForeignContent foreignContent){
  IReportContent reportContent=getReportContent();
  handleOnRender(foreignContent);
  String rawFormat=foreignContent.getRawType();
  Object rawValue=foreignContent.getRawValue();
  if (IForeignContent.TEMPLATE_TYPE.equals(rawFormat)) {
    processTemplateContent(foreignContent);
    return foreignContent;
  }
  if (IForeignContent.EXTERNAL_TYPE.equals(rawFormat)) {
    return processExtendedContent(foreignContent);
  }
  if (IForeignContent.IMAGE_TYPE.equals(rawFormat)) {
    if (rawValue instanceof IImageContent) {
      IImageContent image=(IImageContent)rawValue;
      processImage(image);
      return image;
    }
    if (rawValue instanceof byte[]) {
      IImageContent imageContent=reportContent.createImageContent(foreignContent);
      imageContent.setImageSource(IImageContent.IMAGE_EXPRESSION);
      imageContent.setData((byte[])rawValue);
      processImage(imageContent);
      return imageContent;
    }
  }
  if (IForeignContent.TEXT_TYPE.equals(rawFormat)) {
    ITextContent textContent=reportContent.createDataContent(foreignContent);
    textContent.setText(rawValue == null ? "String_Node_Str" : rawValue.toString());
    return textContent;
  }
  if (IForeignContent.HTML_TYPE.equals(rawFormat)) {
    String key=foreignContent.getRawKey();
    if (key != null) {
      String text=localize(foreignContent,key,null);
      if (text != null) {
        foreignContent.setRawValue(text);
      }
    }
 else {
      Object value=foreignContent.getRawValue();
      String text=format(value,foreignContent.getComputedStyle());
      if (text != null) {
        foreignContent.setRawValue(text);
      }
    }
    return foreignContent;
  }
  if (IForeignContent.VALUE_TYPE.equals(rawFormat)) {
    IDataContent dataContent=reportContent.createDataContent(foreignContent);
    dataContent.setParent(foreignContent.getParent());
    dataContent.setValue(rawValue);
    processData(dataContent);
    return dataContent;
  }
  return foreignContent;
}