Program: 44054
Project: 44054
Buggy source:
/** 
 * Write complex type file.
 * @param doc the doc
 * @param type the type
 * @param parentPath the parent path
 * @throws OutputFormatterException
 */
private void writeComplexTypeFile(WSDLDocInterface doc,ComplexType type,String parentPath) throws OutputFormatterException {
  logger.entering("String_Node_Str","String_Node_Str",new Object[]{doc,type});
  processedTypes.add(type);
  boolean isRecursive=false;
  StringBuffer html=new StringBuffer();
  String typeName=type.getName();
  if (typeName != null && !Utils.isEmpty(typeName)) {
    String parentType=type.getParentType();
    if (!Utils.isEmpty(parentType)) {
      parentType=Utils.removeNameSpace(parentType);
      ComplexType parent=doc.searchCType(parentType);
      if (parent != null && !processedTypes.contains(parent)) {
        writeComplexTypeFile(doc,parent,parentPath);
      }
    }
    html=new StringBuffer();
    html.append(HtmlUtils.getStartTags(typeName,currentPackageName + TYPES));
    buildHeader(html,true,true,type.getName(),getRelativePath(currentPackageName + TYPES),false,null);
    html.append(getTextInDiv("String_Node_Str" + typeName,"String_Node_Str"));
    html.append(Constants.HTML_HR);
    html.append(Constants.HTML_DL_START + Constants.HTML_DD_START);
    if (!Utils.isEmpty(parentType)) {
      html.append(getTextInSpan("String_Node_Str","String_Node_Str"));
      html.append(HtmlUtils.getAnchorTag(null,parentType + Constants.DOT_HTML,parentType,parentType) + Constants.HTML_BR);
    }
    if (type.getAnnotations().getDocumentation() != null) {
      html.append(getTextInSpan(type.getAnnotations().getDocumentation(),"String_Node_Str"));
    }
    html.append(Constants.HTML_DD_END + Constants.HTML_DL_END);
    StringBuffer deprDet=AnnotationsHelper.processDeprication(type.getAnnotations());
    if (deprDet != null) {
      html.append(getTextInDiv("String_Node_Str","String_Node_Str"));
      html.append(deprDet);
    }
    processRelatedInfo(html,doc,type.getAnnotations());
    html.append(Constants.HTML_HR);
    buildFieldSummary(html,doc,type);
    html.append(Constants.HTML_HR);
    html.append(HtmlUtils.getAnchorTag("String_Node_Str",null,null,null));
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append(getTableHeadTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    html.append(Constants.HTML_TABLE_END);
    Set<Element> elements=type.getChildElements();
    if (type.getSimpleAttributeContent() != null) {
      elements.addAll(type.getSimpleAttributeContent());
    }
    if (elements.isEmpty()) {
      html.append(type.getName() + "String_Node_Str");
      html.append(Constants.HTML_TABLE_END);
    }
 else {
      html.append(Constants.HTML_BR + Constants.HTML_BR);
      for (      Element element : elements) {
        if (parentPath.contains("String_Node_Str" + element.getName() + "String_Node_Str")) {
          isRecursive=true;
        }
        String nodePath=parentPath + "String_Node_Str" + element.getName();
        String typeCName=getCTypeTypeName(element.getType());
        if (type.getName().equalsIgnoreCase(typeCName)) {
          isRecursive=true;
        }
        html.append(HtmlUtils.getAnchorTag(element.getName(),null,null,null));
        if (doc.searchCType(typeCName) != null && !isRecursive) {
          writeComplexTypeFile(doc,doc.searchCType(typeCName),nodePath);
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + HtmlUtils.getAnchorTag(null,typeCName + Constants.DOT_HTML,typeCName,typeCName)+ "String_Node_Str","String_Node_Str"));
        }
 else         if (doc.searchSimpleType(typeCName) != null) {
          writeSimpleTypeFile(doc,doc.searchSimpleType(typeCName));
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + HtmlUtils.getAnchorTag(null,typeCName + Constants.DOT_HTML,typeCName,typeCName)+ "String_Node_Str","String_Node_Str"));
        }
 else {
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + typeCName+ "String_Node_Str","String_Node_Str"));
        }
        if (element.getAnnotationInfo().getDocumentation() != null) {
          html.append(Constants.HTML_BR + getTextInSpan(element.getAnnotationInfo().getDocumentation(),"String_Node_Str"));
        }
        processDefaultsAndBoundries(html,doc,element);
        deprDet=AnnotationsHelper.processDeprication(element.getAnnotationInfo());
        if (deprDet != null) {
          html.append(getTextInDiv("String_Node_Str","String_Node_Str"));
          html.append(deprDet);
        }
        processRelatedInfo(html,doc,element.getAnnotationInfo());
        html.append(Constants.HTML_HR + Constants.HTML_BR);
      }
    }
    writeUseFile(doc,type,parentPath);
    addFooter(html,true,true,type.getName(),getRelativePath(currentPackageName + TYPES),false,null);
    writeFile(html,currentTypesFolderPath,typeName + Constants.DOT_HTML);
  }
  logger.exiting("String_Node_Str","String_Node_Str",html);
}

Fixed version (ground truth):
/** 
 * Write complex type file.
 * @param doc the doc
 * @param type the type
 * @param parentPath the parent path
 * @throws OutputFormatterException
 */
private void writeComplexTypeFile(WSDLDocInterface doc,ComplexType type,String parentPath) throws OutputFormatterException {
  logger.entering("String_Node_Str","String_Node_Str",new Object[]{doc,type});
  processedTypes.add(type);
  boolean isRecursive=false;
  StringBuffer html=new StringBuffer();
  String typeName=type.getName();
  if (typeName != null && !Utils.isEmpty(typeName)) {
    String parentType=type.getParentType();
    if (!Utils.isEmpty(parentType)) {
      parentType=Utils.removeNameSpace(parentType);
      ComplexType parent=doc.searchCType(parentType);
      if (parent != null && !processedTypes.contains(parent)) {
        writeComplexTypeFile(doc,parent,parentPath);
      }
    }
    html=new StringBuffer();
    html.append(HtmlUtils.getStartTags(typeName,currentPackageName + TYPES));
    Map<String,String> replacementMap=new HashMap<String,String>();
    replacementMap.put("String_Node_Str",getRelativePath(currentPackageName + TYPES));
    replacementMap.put("String_Node_Str",type.getName());
    buildHeader(html,replacementMap,"String_Node_Str");
    html.append(getTextInDiv("String_Node_Str" + typeName,"String_Node_Str"));
    html.append(Constants.HTML_HR);
    html.append(Constants.HTML_DL_START + Constants.HTML_DD_START);
    if (!Utils.isEmpty(parentType)) {
      html.append(getTextInSpan("String_Node_Str","String_Node_Str"));
      html.append(HtmlUtils.getAnchorTag(null,parentType + Constants.DOT_HTML,parentType,parentType) + Constants.HTML_BR);
    }
    if (type.getAnnotations().getDocumentation() != null) {
      html.append(getTextInSpan(type.getAnnotations().getDocumentation(),"String_Node_Str"));
    }
    html.append(Constants.HTML_DD_END + Constants.HTML_DL_END);
    StringBuffer deprDet=AnnotationsHelper.processDeprication(type.getAnnotations());
    if (deprDet != null) {
      html.append(getTextInDiv("String_Node_Str","String_Node_Str"));
      html.append(deprDet);
    }
    processRelatedInfo(html,doc,type.getAnnotations());
    html.append(Constants.HTML_HR);
    buildFieldSummary(html,doc,type);
    html.append(Constants.HTML_HR);
    html.append(HtmlUtils.getAnchorTag("String_Node_Str",null,null,null));
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append(getTableHeadTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    html.append(Constants.HTML_TABLE_END);
    Set<Element> elements=type.getChildElements();
    if (type.getSimpleAttributeContent() != null) {
      elements.addAll(type.getSimpleAttributeContent());
    }
    if (elements.isEmpty()) {
      html.append(type.getName() + "String_Node_Str");
      html.append(Constants.HTML_TABLE_END);
    }
 else {
      html.append(Constants.HTML_BR + Constants.HTML_BR);
      for (      Element element : elements) {
        if (parentPath.contains("String_Node_Str" + element.getName() + "String_Node_Str")) {
          isRecursive=true;
        }
        String nodePath=parentPath + "String_Node_Str" + element.getName();
        String typeCName=getCTypeTypeName(element.getType());
        if (type.getName().equalsIgnoreCase(typeCName)) {
          isRecursive=true;
        }
        html.append(HtmlUtils.getAnchorTag(element.getName(),null,null,null));
        if (doc.searchCType(typeCName) != null && !isRecursive) {
          writeComplexTypeFile(doc,doc.searchCType(typeCName),nodePath);
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + HtmlUtils.getAnchorTag(null,typeCName + Constants.DOT_HTML,typeCName,typeCName)+ "String_Node_Str","String_Node_Str"));
        }
 else         if (doc.searchSimpleType(typeCName) != null) {
          writeSimpleTypeFile(doc,doc.searchSimpleType(typeCName));
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + HtmlUtils.getAnchorTag(null,typeCName + Constants.DOT_HTML,typeCName,typeCName)+ "String_Node_Str","String_Node_Str"));
        }
 else {
          html.append(getTextInSpan(element.getName() + "String_Node_Str" + typeCName+ "String_Node_Str","String_Node_Str"));
        }
        if (element.getAnnotationInfo().getDocumentation() != null) {
          html.append(Constants.HTML_BR + getTextInSpan(element.getAnnotationInfo().getDocumentation(),"String_Node_Str"));
        }
        processDefaultsAndBoundries(html,doc,element);
        deprDet=AnnotationsHelper.processDeprication(element.getAnnotationInfo());
        if (deprDet != null) {
          html.append(getTextInDiv("String_Node_Str","String_Node_Str"));
          html.append(deprDet);
        }
        processRelatedInfo(html,doc,element.getAnnotationInfo());
        html.append(Constants.HTML_HR + Constants.HTML_BR);
      }
    }
    writeUseFile(doc,type,parentPath);
    addFooter(html,replacementMap,"String_Node_Str");
    writeFile(html,currentTypesFolderPath,typeName + Constants.DOT_HTML);
  }
  logger.exiting("String_Node_Str","String_Node_Str",html);
}