Program: 23267
Project: 23267
Buggy source:
public String generate(String title,List<ValidationMessage> allErrors,List<FetchedFile> files,String path) throws IOException {
  List<ValidationMessage> linkErrors=removeDupMessages(allErrors);
  StringBuilder b=new StringBuilder();
  b.append(genHeader(title));
  b.append(genSummaryRowInteral(linkErrors));
  files=sorted(files);
  for (  FetchedFile f : files)   b.append(genSummaryRow(f));
  b.append(genEnd());
  b.append(genStartInternal());
  for (  ValidationMessage vm : linkErrors)   b.append(genDetails(vm));
  b.append(genEnd());
  for (  FetchedFile f : files) {
    b.append(genStart(f));
    for (    ValidationMessage vm : f.getErrors())     b.append(genDetails(vm));
    b.append(genEnd());
  }
  b.append(genFooter(title));
  TextFile.stringToFile(b.toString(),path);
  Bundle validationBundle=new Bundle().setType(Bundle.BundleType.COLLECTION);
  OperationOutcome oo=new OperationOutcome();
  validationBundle.addEntry(new BundleEntryComponent().setResource(oo));
  for (  ValidationMessage vm : linkErrors) {
    oo.getIssue().add(OperationOutcomeUtilities.convertToIssue(vm,oo));
  }
  for (  FetchedFile f : files) {
    if (!f.getErrors().isEmpty()) {
      oo=new OperationOutcome();
      validationBundle.addEntry(new BundleEntryComponent().setResource(oo));
      ToolingExtensions.addStringExtension(oo,ToolingExtensions.EXT_OO_FILE,f.getName());
      for (      ValidationMessage vm : removeDupMessages(f.getErrors())) {
        oo.getIssue().add(OperationOutcomeUtilities.convertToIssue(vm,oo));
      }
    }
  }
  FileOutputStream s=new FileOutputStream(Utilities.changeFileExt(path,"String_Node_Str"));
  new XmlParser().compose(s,validationBundle,true);
  s.close();
  b=new StringBuilder();
  b.append(genHeaderTxt(title));
  b.append(genSummaryRowTxtInternal(linkErrors));
  files=sorted(files);
  for (  FetchedFile f : files)   b.append(genSummaryRowTxt(f));
  b.append(genEnd());
  b.append(genStartTxtInternal());
  for (  ValidationMessage vm : linkErrors)   b.append(genDetailsTxt(vm));
  b.append(genEndTxt());
  for (  FetchedFile f : files) {
    b.append(genStartTxt(f));
    for (    ValidationMessage vm : f.getErrors())     b.append(genDetailsTxt(vm));
    b.append(genEndTxt());
  }
  b.append(genFooterTxt(title));
  TextFile.stringToFile(b.toString(),Utilities.changeFileExt(path,"String_Node_Str"));
  return path;
}

Fixed version (ground truth):
public String generate(String title,List<ValidationMessage> allErrors,List<FetchedFile> files,String path) throws IOException {
  List<ValidationMessage> linkErrors=removeDupMessages(allErrors);
  StringBuilder b=new StringBuilder();
  b.append(genHeader(title));
  b.append(genSummaryRowInteral(linkErrors));
  files=sorted(files);
  for (  FetchedFile f : files)   b.append(genSummaryRow(f));
  b.append(genEnd());
  b.append(genStartInternal());
  for (  ValidationMessage vm : linkErrors)   b.append(genDetails(vm));
  b.append(genEnd());
  for (  FetchedFile f : files) {
    b.append(genStart(f));
    for (    ValidationMessage vm : removeDupMessages(f.getErrors()))     b.append(genDetails(vm));
    b.append(genEnd());
  }
  b.append(genFooter(title));
  TextFile.stringToFile(b.toString(),path);
  Bundle validationBundle=new Bundle().setType(Bundle.BundleType.COLLECTION);
  OperationOutcome oo=new OperationOutcome();
  validationBundle.addEntry(new BundleEntryComponent().setResource(oo));
  for (  ValidationMessage vm : linkErrors) {
    oo.getIssue().add(OperationOutcomeUtilities.convertToIssue(vm,oo));
  }
  for (  FetchedFile f : files) {
    if (!f.getErrors().isEmpty()) {
      oo=new OperationOutcome();
      validationBundle.addEntry(new BundleEntryComponent().setResource(oo));
      ToolingExtensions.addStringExtension(oo,ToolingExtensions.EXT_OO_FILE,f.getName());
      for (      ValidationMessage vm : removeDupMessages(f.getErrors())) {
        oo.getIssue().add(OperationOutcomeUtilities.convertToIssue(vm,oo));
      }
    }
  }
  FileOutputStream s=new FileOutputStream(Utilities.changeFileExt(path,"String_Node_Str"));
  new XmlParser().compose(s,validationBundle,true);
  s.close();
  b=new StringBuilder();
  b.append(genHeaderTxt(title));
  b.append(genSummaryRowTxtInternal(linkErrors));
  files=sorted(files);
  for (  FetchedFile f : files)   b.append(genSummaryRowTxt(f));
  b.append(genEnd());
  b.append(genStartTxtInternal());
  for (  ValidationMessage vm : linkErrors)   b.append(genDetailsTxt(vm));
  b.append(genEndTxt());
  for (  FetchedFile f : files) {
    b.append(genStartTxt(f));
    for (    ValidationMessage vm : removeDupMessages(f.getErrors()))     b.append(genDetailsTxt(vm));
    b.append(genEndTxt());
  }
  b.append(genFooterTxt(title));
  TextFile.stringToFile(b.toString(),Utilities.changeFileExt(path,"String_Node_Str"));
  return path;
}