Program: 81300
Project: 81300
Buggy source:
private void writeUseFile(WSDLDocInterface doc,ComplexType type,String parentPath) throws OutputFormatterException {
  logger.entering("String_Node_Str","String_Node_Str");
  StringBuffer html=new StringBuffer();
  html.append(HtmlUtils.getStartTags(type.getName(),currentPackageName + "String_Node_Str"));
  addHeadingTable(html,"String_Node_Str" + type.getName());
  boolean tableAdded=false;
  Set<String> methods=returnTypeToMethodMap.get(type.getName());
  if (methods != null) {
    html.append(Constants.HTML_BR_TWICE);
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append("String_Node_Str" + type.getName());
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    for (    String str : methods) {
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + type.getName() + Constants.DOT_HTML,null,type.getName()));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(str);
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(Constants.HTML_TABLE_TR_END);
    }
    html.append(Constants.HTML_TABLE_END);
    tableAdded=true;
  }
  methods=paramsToMethodMap.get(type.getName());
  if (methods != null) {
    html.append(Constants.HTML_BR_TWICE);
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append("String_Node_Str" + type.getName());
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    Iterator<String> itMethods=methods.iterator();
    while (itMethods.hasNext()) {
      String method=itMethods.next();
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      String retTypeName=method.substring(0,method.indexOf('-'));
      html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + retTypeName + Constants.DOT_HTML,null,retTypeName));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(method.substring(method.indexOf('-') + 1));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(Constants.HTML_TABLE_TR_END);
    }
    html.append(Constants.HTML_TABLE_END);
    tableAdded=true;
  }
  if (doc instanceof WSDLDocument) {
    Map<String,List<ComplexType>> map=doc.getElementComplexTypeMap();
    List<ComplexType> tempTypes=map.get(type.getName());
    if (tempTypes != null) {
      html.append(Constants.HTML_BR_TWICE);
      html.append(getTableTagWithStyle("String_Node_Str"));
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append("String_Node_Str");
      html.append("String_Node_Str" + type.getName());
      html.append(Constants.HTML_TABLE_TH_END);
      html.append(Constants.HTML_TABLE_TR_END);
      Set<String> set=new TreeSet<String>();
      if (tempTypes != null) {
        for (        ComplexType tempType : tempTypes) {
          set.addAll(getExtensionTypes(tempType.getName(),doc));
        }
      }
      Iterator<String> setIterator=set.iterator();
      while (setIterator.hasNext()) {
        html.append(getTableRowTagWithStyle("String_Node_Str"));
        html.append(getTableDataTagWithStyle("String_Node_Str"));
        String name=setIterator.next();
        html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + name + Constants.DOT_HTML,null,name));
        html.append(Constants.HTML_TABLE_TD_END);
        ComplexType cType=doc.searchCType(Utils.removeNameSpace(name));
        String desc="String_Node_Str";
        if (cType != null) {
          desc=cType.getAnnotations().getDocumentation();
        }
        html.append(getTableDataTagWithStyle("String_Node_Str"));
        html.append(desc);
        html.append(Constants.HTML_TABLE_TD_END);
        html.append(Constants.HTML_TABLE_TR_END);
      }
      html.append(Constants.HTML_TABLE_END);
      tableAdded=true;
    }
  }
  if (!tableAdded) {
    html.append(type.getName() + "String_Node_Str");
  }
  html.append(Constants.HTML_BR);
  writeFile(html,classUseFolderPath,type.getName() + Constants.DOT_HTML);
  logger.exiting("String_Node_Str","String_Node_Str",html);
}

Fixed version (ground truth):
private void writeUseFile(WSDLDocInterface doc,ComplexType type,String parentPath) throws OutputFormatterException {
  logger.entering("String_Node_Str","String_Node_Str");
  StringBuffer html=new StringBuffer();
  html.append(HtmlUtils.getStartTags(type.getName(),currentPackageName + "String_Node_Str"));
  Map<String,String> replacementMap=new HashMap<String,String>();
  replacementMap.put("String_Node_Str",getRelativePath(currentPackageName + "String_Node_Str"));
  replacementMap.put("String_Node_Str","String_Node_Str");
  buildHeader(html,replacementMap,"String_Node_Str");
  addHeadingTable(html,"String_Node_Str" + type.getName());
  boolean tableAdded=false;
  Set<String> methods=returnTypeToMethodMap.get(type.getName());
  if (methods != null) {
    html.append(Constants.HTML_BR_TWICE);
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append("String_Node_Str" + type.getName());
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    for (    String str : methods) {
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + type.getName() + Constants.DOT_HTML,null,type.getName()));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(str);
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(Constants.HTML_TABLE_TR_END);
    }
    html.append(Constants.HTML_TABLE_END);
    tableAdded=true;
  }
  methods=paramsToMethodMap.get(type.getName());
  if (methods != null) {
    html.append(Constants.HTML_BR_TWICE);
    html.append(getTableTagWithStyle("String_Node_Str"));
    html.append(getTableRowTagWithStyle("String_Node_Str"));
    html.append("String_Node_Str");
    html.append("String_Node_Str" + type.getName());
    html.append(Constants.HTML_TABLE_TH_END);
    html.append(Constants.HTML_TABLE_TR_END);
    Iterator<String> itMethods=methods.iterator();
    while (itMethods.hasNext()) {
      String method=itMethods.next();
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      String retTypeName=method.substring(0,method.indexOf('-'));
      html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + retTypeName + Constants.DOT_HTML,null,retTypeName));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(getTableDataTagWithStyle("String_Node_Str"));
      html.append(method.substring(method.indexOf('-') + 1));
      html.append(Constants.HTML_TABLE_TD_END);
      html.append(Constants.HTML_TABLE_TR_END);
    }
    html.append(Constants.HTML_TABLE_END);
    tableAdded=true;
  }
  if (doc instanceof WSDLDocument) {
    Map<String,List<ComplexType>> map=doc.getElementComplexTypeMap();
    List<ComplexType> tempTypes=map.get(type.getName());
    if (tempTypes != null) {
      html.append(Constants.HTML_BR_TWICE);
      html.append(getTableTagWithStyle("String_Node_Str"));
      html.append(getTableRowTagWithStyle("String_Node_Str"));
      html.append("String_Node_Str");
      html.append("String_Node_Str" + type.getName());
      html.append(Constants.HTML_TABLE_TH_END);
      html.append(Constants.HTML_TABLE_TR_END);
      Set<String> set=new TreeSet<String>();
      if (tempTypes != null) {
        for (        ComplexType tempType : tempTypes) {
          set.addAll(getExtensionTypes(tempType.getName(),doc));
        }
      }
      Iterator<String> setIterator=set.iterator();
      while (setIterator.hasNext()) {
        html.append(getTableRowTagWithStyle("String_Node_Str"));
        html.append(getTableDataTagWithStyle("String_Node_Str"));
        String name=setIterator.next();
        html.append(HtmlUtils.getAnchorTag(null,"String_Node_Str" + name + Constants.DOT_HTML,null,name));
        html.append(Constants.HTML_TABLE_TD_END);
        ComplexType cType=doc.searchCType(Utils.removeNameSpace(name));
        String desc="String_Node_Str";
        if (cType != null) {
          desc=cType.getAnnotations().getDocumentation();
        }
        html.append(getTableDataTagWithStyle("String_Node_Str"));
        html.append(desc);
        html.append(Constants.HTML_TABLE_TD_END);
        html.append(Constants.HTML_TABLE_TR_END);
      }
      html.append(Constants.HTML_TABLE_END);
      tableAdded=true;
    }
  }
  if (!tableAdded) {
    html.append(type.getName() + "String_Node_Str");
  }
  html.append(Constants.HTML_BR);
  addFooter(html,replacementMap,"String_Node_Str");
  html.append(HtmlUtils.getEndTags());
  writeFile(html,classUseFolderPath,type.getName() + Constants.DOT_HTML);
  logger.exiting("String_Node_Str","String_Node_Str",html);
}