nus-yam/ex-repair huggingface dataset:
Program: 23115
Project: 23115
Buggy source:
private void bpCheck(List<ValidationMessage> errors,IssueType invalid,int line,int col,String literalPath,boolean test,String message){
  if (bpWarnings != null) {
switch (bpWarnings) {
case Error:
      rule(errors,invalid,line,col,literalPath,test,message);
case Warning:
    warning(errors,invalid,line,col,literalPath,test,message);
case Hint:
  hint(errors,invalid,line,col,literalPath,test,message);
default :
}
}
}

Fixed version (ground truth):
private void bpCheck(List<ValidationMessage> errors,IssueType invalid,int line,int col,String literalPath,boolean test,String message){
  if (bpWarnings != null) {
switch (bpWarnings) {
case Error:
      rule(errors,invalid,line,col,literalPath,test,message);
    break;
case Warning:
  warning(errors,invalid,line,col,literalPath,test,message);
break;
case Hint:
hint(errors,invalid,line,col,literalPath,test,message);
break;
default :
}
}
}
Program: 23117
Project: 23117
Buggy source:
private String codeForAggregation(AggregationMode a){
switch (a) {
case BUNDLED:
    return "String_Node_Str";
case CONTAINED:
  return "String_Node_Str";
case REFERENCED:
return "String_Node_Str";
}
return "String_Node_Str";
}

Fixed version (ground truth):
private String codeForAggregation(AggregationMode a){
switch (a) {
case BUNDLED:
    return "String_Node_Str";
case CONTAINED:
  return "String_Node_Str";
case REFERENCED:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}
Program: 23120
Project: 23120
Buggy source:
public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator,boolean isExists){
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.PROFILE,discriminator.length() == 8 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 9));
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.TYPE,discriminator.length() == 5 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 6));
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.EXISTS,discriminator.length() == 7 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 8));
  if (isExists)   return makeDiscriminator(DiscriminatorType.EXISTS,discriminator);
  return new ElementDefinitionSlicingDiscriminatorComponent().setType(DiscriminatorType.VALUE).setPath(discriminator);
}

Fixed version (ground truth):
public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator,boolean isExists){
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.PATTERN,discriminator.length() == 8 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 9));
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.PROFILE,discriminator.length() == 8 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 9));
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.TYPE,discriminator.length() == 5 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 6));
  if (discriminator.endsWith("String_Node_Str"))   return makeDiscriminator(DiscriminatorType.EXISTS,discriminator.length() == 7 ? "String_Node_Str" : discriminator.substring(discriminator.length() - 8));
  if (isExists)   return makeDiscriminator(DiscriminatorType.EXISTS,discriminator);
  return new ElementDefinitionSlicingDiscriminatorComponent().setType(DiscriminatorType.VALUE).setPath(discriminator);
}
Program: 23121
Project: 23121
Buggy source:
private String codeForAggregation(AggregationMode a){
switch (a) {
case BUNDLED:
    return "String_Node_Str";
case CONTAINED:
  return "String_Node_Str";
case REFERENCED:
return "String_Node_Str";
}
return "String_Node_Str";
}

Fixed version (ground truth):
private String codeForAggregation(AggregationMode a){
switch (a) {
case BUNDLED:
    return "String_Node_Str";
case CONTAINED:
  return "String_Node_Str";
case REFERENCED:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}
Program: 23124
Project: 23124
Buggy source:
private List<Base> funcResolve(ExecutionContext context,List<Base> focus,ExpressionNode exp){
  List<Base> result=new ArrayList<Base>();
  for (  Base item : focus) {
    if (hostServices != null) {
      String s=convertToString(item);
      if (item.fhirType().equals("String_Node_Str")) {
        Property p=item.getChildByName("String_Node_Str");
        if (p.hasValues())         s=convertToString(p.getValues().get(0));
      }
      Base res=null;
      if (s.startsWith("String_Node_Str")) {
        String id=s.substring(1);
        Property p=context.resource.getChildByName("String_Node_Str");
        for (        Base c : p.getValues()) {
          if (id.equals(c.getIdBase()))           res=c;
        }
      }
 else       res=hostServices.resolveReference(context.appInfo,s);
      if (res != null)       result.add(res);
    }
  }
  return result;
}

Fixed version (ground truth):
private List<Base> funcResolve(ExecutionContext context,List<Base> focus,ExpressionNode exp){
  List<Base> result=new ArrayList<Base>();
  for (  Base item : focus) {
    if (hostServices != null) {
      String s=convertToString(item);
      if (item.fhirType().equals("String_Node_Str")) {
        Property p=item.getChildByName("String_Node_Str");
        if (p != null && p.hasValues())         s=convertToString(p.getValues().get(0));
 else         s=null;
      }
      if (s != null) {
        Base res=null;
        if (s.startsWith("String_Node_Str")) {
          String id=s.substring(1);
          Property p=context.resource.getChildByName("String_Node_Str");
          for (          Base c : p.getValues()) {
            if (id.equals(c.getIdBase())) {
              res=c;
              break;
            }
          }
        }
 else         res=hostServices.resolveReference(context.appInfo,s);
        if (res != null)         result.add(res);
      }
    }
  }
  return result;
}
Program: 23125
Project: 23125
Buggy source:
private TypeDetails executeType(String type,ExpressionNode exp,boolean atEntry) throws PathEngineException, DefinitionException {
  if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && tail(type).equals(exp.getName()))   return new TypeDetails(CollectionStatus.SINGLETON,type);
  TypeDetails result=new TypeDetails(null);
  getChildTypesByName(type,exp.getName(),result);
  return result;
}

Fixed version (ground truth):
private TypeDetails executeType(String type,ExpressionNode exp,boolean atEntry) throws PathEngineException, DefinitionException {
  if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && hashTail(type).equals(exp.getName()))   return new TypeDetails(CollectionStatus.SINGLETON,type);
  TypeDetails result=new TypeDetails(null);
  getChildTypesByName(type,exp.getName(),result);
  return result;
}
Program: 23127
Project: 23127
Buggy source:
private List<Base> funcReplace(ExecutionContext context,List<Base> focus,ExpressionNode exp){
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
private List<Base> funcReplace(ExecutionContext context,List<Base> focus,ExpressionNode exp) throws FHIRException, PathEngineException {
  List<Base> result=new ArrayList<Base>();
  if (focus.size() == 1) {
    String f=convertToString(focus.get(0));
    if (!Utilities.noString(f)) {
      if (exp.getParameters().size() != 2) {
        String t=convertToString(execute(context,focus,exp.getParameters().get(0),true));
        String r=convertToString(execute(context,focus,exp.getParameters().get(1),true));
        String n=f.replace(t,r);
        result.add(new StringType(n));
      }
 else {
        throw new PathEngineException(String.format("String_Node_Str",exp.getParameters().size()));
      }
    }
 else {
      throw new PathEngineException(String.format("String_Node_Str"));
    }
  }
 else {
    throw new PathEngineException(String.format("String_Node_Str",focus.size()));
  }
  return result;
}
Program: 23129
Project: 23129
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    comp.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    prop(name,comp.compose(html));
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(true,htmlPretty);
    prop(name,comp.compose(html));
  }
}
Program: 23130
Project: 23130
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    if (html.getNodeType() != NodeType.Text)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(true,htmlPretty);
    boolean oldPretty=xml.isPretty();
    if (html.getNodeType() != NodeType.Text)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}
Program: 23131
Project: 23131
Buggy source:
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer().setXmlOnly(true).composePlainText(oo.getText().getDiv())));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs,null));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}

Fixed version (ground truth):
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer(true,false).composePlainText(oo.getText().getDiv())));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs,null));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}
Program: 23132
Project: 23132
Buggy source:
private void inject(Element er,XhtmlNode x,NarrativeStatus status){
  Element txt=XMLUtil.getNamedChild(er,"String_Node_Str");
  if (txt == null) {
    txt=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(er);
    while (n != null && (n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str")|| n.getNodeName().equals("String_Node_Str")))     n=XMLUtil.getNextSibling(n);
    if (n == null)     er.appendChild(txt);
 else     er.insertBefore(txt,n);
  }
  Element st=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (st == null) {
    st=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(txt);
    if (n == null)     txt.appendChild(st);
 else     txt.insertBefore(st,n);
  }
  st.setAttribute("String_Node_Str",status.toCode());
  Element div=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (div == null) {
    div=er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str");
    div.setAttribute("String_Node_Str",FormatUtilities.XHTML_NS);
    txt.appendChild(div);
  }
  if (div.hasChildNodes())   div.appendChild(er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str"));
  new XhtmlComposer().compose(div,x);
}

Fixed version (ground truth):
private void inject(Element er,XhtmlNode x,NarrativeStatus status){
  Element txt=XMLUtil.getNamedChild(er,"String_Node_Str");
  if (txt == null) {
    txt=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(er);
    while (n != null && (n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str")|| n.getNodeName().equals("String_Node_Str")))     n=XMLUtil.getNextSibling(n);
    if (n == null)     er.appendChild(txt);
 else     er.insertBefore(txt,n);
  }
  Element st=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (st == null) {
    st=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(txt);
    if (n == null)     txt.appendChild(st);
 else     txt.insertBefore(st,n);
  }
  st.setAttribute("String_Node_Str",status.toCode());
  Element div=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (div == null) {
    div=er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str");
    div.setAttribute("String_Node_Str",FormatUtilities.XHTML_NS);
    txt.appendChild(div);
  }
  if (div.hasChildNodes())   div.appendChild(er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str"));
  new XhtmlComposer(true,pretty).compose(div,x);
}
Program: 23133
Project: 23133
Buggy source:
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer().setXmlOnly(true).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer(true,false).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}
Program: 23134
Project: 23134
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    comp.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    prop(name,comp.compose(html));
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(true,htmlPretty);
    prop(name,comp.compose(html));
  }
}
Program: 23135
Project: 23135
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(true,htmlPretty);
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}
Program: 23137
Project: 23137
Buggy source:
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer().setXmlOnly(true).composePlainText(oo.getText().getDiv())));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs,null));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}

Fixed version (ground truth):
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer(true,false).composePlainText(oo.getText().getDiv())));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs,null));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}
Program: 23138
Project: 23138
Buggy source:
private void inject(Element er,XhtmlNode x,NarrativeStatus status){
  Element txt=XMLUtil.getNamedChild(er,"String_Node_Str");
  if (txt == null) {
    txt=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(er);
    while (n != null && (n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str")|| n.getNodeName().equals("String_Node_Str")))     n=XMLUtil.getNextSibling(n);
    if (n == null)     er.appendChild(txt);
 else     er.insertBefore(txt,n);
  }
  Element st=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (st == null) {
    st=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(txt);
    if (n == null)     txt.appendChild(st);
 else     txt.insertBefore(st,n);
  }
  st.setAttribute("String_Node_Str",status.toCode());
  Element div=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (div == null) {
    div=er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str");
    div.setAttribute("String_Node_Str",FormatUtilities.XHTML_NS);
    txt.appendChild(div);
  }
  if (div.hasChildNodes())   div.appendChild(er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str"));
  new XhtmlComposer().compose(div,x);
}

Fixed version (ground truth):
private void inject(Element er,XhtmlNode x,NarrativeStatus status){
  Element txt=XMLUtil.getNamedChild(er,"String_Node_Str");
  if (txt == null) {
    txt=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(er);
    while (n != null && (n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str") || n.getNodeName().equals("String_Node_Str")|| n.getNodeName().equals("String_Node_Str")))     n=XMLUtil.getNextSibling(n);
    if (n == null)     er.appendChild(txt);
 else     er.insertBefore(txt,n);
  }
  Element st=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (st == null) {
    st=er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS,"String_Node_Str");
    Element n=XMLUtil.getFirstChild(txt);
    if (n == null)     txt.appendChild(st);
 else     txt.insertBefore(st,n);
  }
  st.setAttribute("String_Node_Str",status.toCode());
  Element div=XMLUtil.getNamedChild(txt,"String_Node_Str");
  if (div == null) {
    div=er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str");
    div.setAttribute("String_Node_Str",FormatUtilities.XHTML_NS);
    txt.appendChild(div);
  }
  if (div.hasChildNodes())   div.appendChild(er.getOwnerDocument().createElementNS(FormatUtilities.XHTML_NS,"String_Node_Str"));
  new XhtmlComposer(true,false).compose(div,x);
}
Program: 23139
Project: 23139
Buggy source:
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer().setXmlOnly(true).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer(true,false).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}
Program: 23141
Project: 23141
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    comp.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    prop(name,comp.compose(html));
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(XhtmlComposer.XML,htmlPretty);
    prop(name,comp.compose(html));
  }
}
Program: 23142
Project: 23142
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(XhtmlComposer.XML,htmlPretty);
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}
Program: 23143
Project: 23143
Buggy source:
@Override public Base[] getProperty(int hash,String name,boolean checkValid) throws FHIRException {
switch (hash) {
case -892481550:
    return this.status == null ? new Base[0] : new Base[]{this.status};
case 99473:
  return this.div == null ? new Base[0] : new Base[]{new StringType(new org.hl7.fhir.utilities.xhtml.XhtmlComposer().setXmlOnly(true).composeEx(this.div))};
default :
return super.getProperty(hash,name,checkValid);
}
}

Fixed version (ground truth):
@Override public Base[] getProperty(int hash,String name,boolean checkValid) throws FHIRException {
switch (hash) {
case -892481550:
    return this.status == null ? new Base[0] : new Base[]{this.status};
case 99473:
  return this.div == null ? new Base[0] : new Base[]{new StringType(new org.hl7.fhir.utilities.xhtml.XhtmlComposer(XhtmlComposer.XML).composeEx(this.div))};
default :
return super.getProperty(hash,name,checkValid);
}
}
Program: 23144
Project: 23144
Buggy source:
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer().setXmlOnly(true).composePlainText(oo.getText().getDiv()),TerminologyServiceErrorClass.UNKNOWN));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}

Fixed version (ground truth):
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer(XhtmlComposer.XML).composePlainText(oo.getText().getDiv()),TerminologyServiceErrorClass.UNKNOWN));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}
Program: 23145
Project: 23145
Buggy source:
private void inject(org.hl7.fhir.dstu3.elementmodel.Element er,XhtmlNode x,NarrativeStatus status) throws DefinitionException, IOException {
  if (!x.hasAttribute("String_Node_Str"))   x.setAttribute("String_Node_Str","String_Node_Str");
  org.hl7.fhir.dstu3.elementmodel.Element txt=er.getNamedChild("String_Node_Str");
  if (txt == null) {
    txt=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",er.getProperty().getChild(null,"String_Node_Str"));
    int i=0;
    while (i < er.getChildren().size() && (er.getChildren().get(i).getName().equals("String_Node_Str") || er.getChildren().get(i).getName().equals("String_Node_Str") || er.getChildren().get(i).getName().equals("String_Node_Str")|| er.getChildren().get(i).getName().equals("String_Node_Str")))     i++;
    if (i >= er.getChildren().size())     er.getChildren().add(txt);
 else     er.getChildren().add(i,txt);
  }
  org.hl7.fhir.dstu3.elementmodel.Element st=txt.getNamedChild("String_Node_Str");
  if (st == null) {
    st=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",txt.getProperty().getChild(null,"String_Node_Str"));
    txt.getChildren().add(0,st);
  }
  st.setValue(status.toCode());
  org.hl7.fhir.dstu3.elementmodel.Element div=txt.getNamedChild("String_Node_Str");
  if (div == null) {
    div=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",txt.getProperty().getChild(null,"String_Node_Str"));
    txt.getChildren().add(div);
    div.setValue(new XhtmlComposer().setXmlOnly(true).compose(x));
  }
  div.setXhtml(x);
}

Fixed version (ground truth):
private void inject(org.hl7.fhir.dstu3.elementmodel.Element er,XhtmlNode x,NarrativeStatus status) throws DefinitionException, IOException {
  if (!x.hasAttribute("String_Node_Str"))   x.setAttribute("String_Node_Str","String_Node_Str");
  org.hl7.fhir.dstu3.elementmodel.Element txt=er.getNamedChild("String_Node_Str");
  if (txt == null) {
    txt=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",er.getProperty().getChild(null,"String_Node_Str"));
    int i=0;
    while (i < er.getChildren().size() && (er.getChildren().get(i).getName().equals("String_Node_Str") || er.getChildren().get(i).getName().equals("String_Node_Str") || er.getChildren().get(i).getName().equals("String_Node_Str")|| er.getChildren().get(i).getName().equals("String_Node_Str")))     i++;
    if (i >= er.getChildren().size())     er.getChildren().add(txt);
 else     er.getChildren().add(i,txt);
  }
  org.hl7.fhir.dstu3.elementmodel.Element st=txt.getNamedChild("String_Node_Str");
  if (st == null) {
    st=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",txt.getProperty().getChild(null,"String_Node_Str"));
    txt.getChildren().add(0,st);
  }
  st.setValue(status.toCode());
  org.hl7.fhir.dstu3.elementmodel.Element div=txt.getNamedChild("String_Node_Str");
  if (div == null) {
    div=new org.hl7.fhir.dstu3.elementmodel.Element("String_Node_Str",txt.getProperty().getChild(null,"String_Node_Str"));
    txt.getChildren().add(div);
    div.setValue(new XhtmlComposer(XhtmlComposer.XML).compose(x));
  }
  div.setXhtml(x);
}
Program: 23146
Project: 23146
Buggy source:
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer().setXmlOnly(true).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
public static String getErrorDescription(OperationOutcome error){
  if (error.hasText() && error.getText().hasDiv())   return new XhtmlComposer(XhtmlComposer.XML).composePlainText(error.getText().getDiv());
  StringBuilder b=new StringBuilder();
  for (  OperationOutcomeIssueComponent t : error.getIssue())   if (t.getSeverity() == IssueSeverity.ERROR)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.FATAL)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.WARNING)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
 else   if (t.getSeverity() == IssueSeverity.INFORMATION)   b.append("String_Node_Str" + t.getDetails() + "String_Node_Str");
  return b.toString();
}
Program: 23148
Project: 23148
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    comp.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    prop(name,comp.compose(html));
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    prop(name,"String_Node_Str" + xhtmlMessage + "String_Node_Str");
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(XhtmlComposer.XML,htmlPretty);
    prop(name,comp.compose(html));
  }
}
Program: 23149
Project: 23149
Buggy source:
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer();
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    comp.setXmlOnly(true);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}

Fixed version (ground truth):
protected void composeXhtml(String name,XhtmlNode html) throws IOException {
  if (!Utilities.noString(xhtmlMessage)) {
    xml.enter(XhtmlComposer.XHTML_NS,name);
    xml.comment(xhtmlMessage,false);
    xml.exit(XhtmlComposer.XHTML_NS,name);
  }
 else {
    XhtmlComposer comp=new XhtmlComposer(XhtmlComposer.XML,htmlPretty);
    boolean oldPretty=xml.isPretty();
    xml.setPretty(htmlPretty);
    if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)     xml.namespace(XhtmlComposer.XHTML_NS,null);
    comp.compose(xml,html);
    xml.setPretty(oldPretty);
  }
}
Program: 23150
Project: 23150
Buggy source:
@Override public Base[] getProperty(int hash,String name,boolean checkValid) throws FHIRException {
switch (hash) {
case -892481550:
    return this.status == null ? new Base[0] : new Base[]{this.status};
case 99473:
  return this.div == null ? new Base[0] : new Base[]{new StringType(new org.hl7.fhir.utilities.xhtml.XhtmlComposer().setXmlOnly(true).composeEx(this.div))};
default :
return super.getProperty(hash,name,checkValid);
}
}

Fixed version (ground truth):
@Override public Base[] getProperty(int hash,String name,boolean checkValid) throws FHIRException {
switch (hash) {
case -892481550:
    return this.status == null ? new Base[0] : new Base[]{this.status};
case 99473:
  return this.div == null ? new Base[0] : new Base[]{new StringType(new org.hl7.fhir.utilities.xhtml.XhtmlComposer(XhtmlComposer.XML,false).composeEx(this.div))};
default :
return super.getProperty(hash,name,checkValid);
}
}
Program: 23151
Project: 23151
Buggy source:
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer().setXmlOnly(true).composePlainText(oo.getText().getDiv()),TerminologyServiceErrorClass.UNKNOWN));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}

Fixed version (ground truth):
private void loadCache() throws FHIRFormatError, IOException {
  File[] files=new File(cacheFolder).listFiles();
  for (  File f : files) {
    if (f.getName().endsWith("String_Node_Str")) {
      final FileInputStream is=new FileInputStream(f);
      try {
        Resource r=context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
        if (r instanceof OperationOutcome) {
          OperationOutcome oo=(OperationOutcome)r;
          expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),new ValueSetExpansionOutcome(new XhtmlComposer(XhtmlComposer.XML,false).composePlainText(oo.getText().getDiv()),TerminologyServiceErrorClass.UNKNOWN));
        }
 else {
          ValueSet vs=(ValueSet)r;
          expansions.put(vs.getUrl(),new ValueSetExpansionOutcome(vs));
        }
      }
  finally {
        IOUtils.closeQuietly(is);
      }
    }
  }
}
Program: 23152
Project: 23152
Buggy source:
private void writeText(XhtmlNode node) throws IOException {
  for (  char c : node.getContent().toCharArray()) {
    if (c == '&')     dst.append("String_Node_Str");
 else     if (c == '<')     dst.append("String_Node_Str");
 else     if (c == '>')     dst.append("String_Node_Str");
 else     if (c == '"')     dst.append("String_Node_Str");
 else     if (xmlOnly) {
      dst.append(c);
    }
 else {
      if (c == XhtmlNode.NBSP.charAt(0))       dst.append("String_Node_Str");
 else       if (c == (char)0xA7)       dst.append("String_Node_Str");
 else       if (c == (char)169)       dst.append("String_Node_Str");
 else       if (c == (char)8482)       dst.append("String_Node_Str");
 else       if (c == (char)956)       dst.append("String_Node_Str");
 else       if (c == (char)174)       dst.append("String_Node_Str");
 else       dst.append(c);
    }
  }
}

Fixed version (ground truth):
private void writeText(XhtmlNode node,boolean escapeQuotes) throws IOException {
  for (  char c : node.getContent().toCharArray()) {
    if (c == '&')     dst.append("String_Node_Str");
 else     if (c == '<')     dst.append("String_Node_Str");
 else     if (c == '>')     dst.append("String_Node_Str");
 else     if (escapeQuotes && c == '"')     dst.append("String_Node_Str");
 else     if (xmlOnly) {
      dst.append(c);
    }
 else {
      if (c == XhtmlNode.NBSP.charAt(0))       dst.append("String_Node_Str");
 else       if (c == (char)0xA7)       dst.append("String_Node_Str");
 else       if (c == (char)169)       dst.append("String_Node_Str");
 else       if (c == (char)8482)       dst.append("String_Node_Str");
 else       if (c == (char)956)       dst.append("String_Node_Str");
 else       if (c == (char)174)       dst.append("String_Node_Str");
 else       dst.append(c);
    }
  }
}
Program: 23153
Project: 23153
Buggy source:
private void writeElement(String indent,XhtmlNode node) throws IOException {
  if (!pretty)   indent="String_Node_Str";
  if (node.getChildNodes().size() == 0)   dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else {
    boolean act=node.allChildrenAreText();
    if (act || !pretty)     dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str");
 else     dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str");
    if (node.getName() == "String_Node_Str" && node.getElement("String_Node_Str") == null)     dst.append(indent + "String_Node_Str" + (isPretty() ? "String_Node_Str" : "String_Node_Str"));
    for (    XhtmlNode c : node.getChildNodes())     writeNode(indent + "String_Node_Str",c);
    if (act)     dst.append("String_Node_Str" + node.getName() + "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else     if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text)     dst.append((isPretty() ? "String_Node_Str" + indent : "String_Node_Str") + "String_Node_Str" + node.getName()+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else     dst.append(indent + "String_Node_Str" + node.getName()+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
  }
}

Fixed version (ground truth):
private void writeElement(String indent,XhtmlNode node) throws IOException {
  if (!pretty)   indent="String_Node_Str";
  if (node.getChildNodes().size() == 0)   dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else {
    boolean act=node.allChildrenAreText();
    if (act || !pretty)     dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str");
 else     dst.append(indent + "String_Node_Str" + node.getName()+ attributes(node)+ "String_Node_Str");
    if (node.getName() == "String_Node_Str" && node.getElement("String_Node_Str") == null)     dst.append(indent + "String_Node_Str" + (isPretty() ? "String_Node_Str" : "String_Node_Str"));
    for (    XhtmlNode c : node.getChildNodes())     writeNode(indent + "String_Node_Str",c,node.getName());
    if (act)     dst.append("String_Node_Str" + node.getName() + "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else     if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text)     dst.append((isPretty() ? "String_Node_Str" + indent : "String_Node_Str") + "String_Node_Str" + node.getName()+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
 else     dst.append(indent + "String_Node_Str" + node.getName()+ "String_Node_Str"+ (isPretty() ? "String_Node_Str" : "String_Node_Str"));
  }
}
Program: 23154
Project: 23154
Buggy source:
public void composeDocument(FileOutputStream f,XhtmlNode xhtml) throws IOException {
  byte[] bom=new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF};
  f.write(bom);
  dst=new OutputStreamWriter(f,"String_Node_Str");
  writeNode("String_Node_Str",xhtml);
  dst.flush();
  dst.close();
}

Fixed version (ground truth):
public void composeDocument(FileOutputStream f,XhtmlNode xhtml) throws IOException {
  byte[] bom=new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF};
  f.write(bom);
  dst=new OutputStreamWriter(f,"String_Node_Str");
  writeNode("String_Node_Str",xhtml,null);
  dst.flush();
  dst.close();
}
Program: 23155
Project: 23155
Buggy source:
private void writeNode(String indent,XhtmlNode node) throws IOException {
  if (node.getNodeType() == NodeType.Comment)   writeComment(indent,node);
 else   if (node.getNodeType() == NodeType.DocType)   writeDocType(node);
 else   if (node.getNodeType() == NodeType.Instruction)   writeInstruction(node);
 else   if (node.getNodeType() == NodeType.Element)   writeElement(indent,node);
 else   if (node.getNodeType() == NodeType.Document)   writeDocument(indent,node);
 else   if (node.getNodeType() == NodeType.Text)   writeText(node);
 else   if (node.getNodeType() == null)   throw new IOException("String_Node_Str");
 else   throw new IOException("String_Node_Str" + node.getNodeType().toString());
}

Fixed version (ground truth):
private void writeNode(String indent,XhtmlNode node,String parentName) throws IOException {
  if (node.getNodeType() == NodeType.Comment)   writeComment(indent,node);
 else   if (node.getNodeType() == NodeType.DocType)   writeDocType(node);
 else   if (node.getNodeType() == NodeType.Instruction)   writeInstruction(node);
 else   if (node.getNodeType() == NodeType.Element)   writeElement(indent,node);
 else   if (node.getNodeType() == NodeType.Document)   writeDocument(indent,node);
 else   if (node.getNodeType() == NodeType.Text)   writeText(node,!"String_Node_Str".equals(parentName));
 else   if (node.getNodeType() == null)   throw new IOException("String_Node_Str");
 else   throw new IOException("String_Node_Str" + node.getNodeType().toString());
}
Program: 23156
Project: 23156
Buggy source:
public void compose(OutputStream stream,XhtmlNode x) throws IOException {
  byte[] bom=new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF};
  stream.write(bom);
  dst=new OutputStreamWriter(stream,"String_Node_Str");
  dst.append("String_Node_Str");
  writeNode("String_Node_Str",x);
  dst.append("String_Node_Str");
  dst.flush();
}

Fixed version (ground truth):
public void compose(OutputStream stream,XhtmlNode x) throws IOException {
  byte[] bom=new byte[]{(byte)0xEF,(byte)0xBB,(byte)0xBF};
  stream.write(bom);
  dst=new OutputStreamWriter(stream,"String_Node_Str");
  dst.append("String_Node_Str");
  writeNode("String_Node_Str",x,null);
  dst.append("String_Node_Str");
  dst.flush();
}
Program: 23157
Project: 23157
Buggy source:
private void writeDocument(String indent,XhtmlNode node) throws IOException {
  indent="String_Node_Str";
  for (  XhtmlNode c : node.getChildNodes())   writeNode(indent,c);
}

Fixed version (ground truth):
private void writeDocument(String indent,XhtmlNode node) throws IOException {
  indent="String_Node_Str";
  for (  XhtmlNode c : node.getChildNodes())   writeNode(indent,c,node.getName());
}
Program: 23158
Project: 23158
Buggy source:
private void composeDoc(XhtmlDocument doc) throws IOException {
  for (  XhtmlNode c : doc.getChildNodes())   writeNode("String_Node_Str",c);
}

Fixed version (ground truth):
private void composeDoc(XhtmlDocument doc) throws IOException {
  for (  XhtmlNode c : doc.getChildNodes())   writeNode("String_Node_Str",c,null);
}