Program: 96660
Project: 96660
Buggy source:
@Override public void generateBody(ExcelXmlWriter sheetWriter) throws Exception {
  Collection<Artifact> directRequirements=source.getAllSwRequirements();
  HashCollection<String,Artifact> partitionMap=ArtifactOperations.sortByPartition(directRequirements);
  HashCollection<Artifact,String> requirementsToQualificationMethod=getQualificationMethods(source);
  HashCollection<String,String> partitionToQualificationMethod=new HashCollection<String,String>(false,TreeSet.class);
  HashCollection<String,Artifact> qualificationMethodToRequirements=new HashCollection<String,Artifact>(false,TreeSet.class);
  for (  String partition : partitionMap.keySet()) {
    for (    Artifact artifact : partitionMap.getValues(partition)) {
      Collection<String> values=requirementsToQualificationMethod.getValues(artifact);
      if (values != null) {
        for (        String codeUnit : values) {
          if (Strings.isValid(codeUnit)) {
            int index=codeUnit.lastIndexOf(File.separator);
            codeUnit=codeUnit.substring(index + 1,codeUnit.length());
          }
          partitionToQualificationMethod.put(partition,codeUnit);
          qualificationMethodToRequirements.put(codeUnit,artifact);
        }
      }
    }
  }
  for (  String partition : new TreeSet<String>(partitionToQualificationMethod.keySet())) {
    List<String> units=new ArrayList<>(partitionToQualificationMethod.getValues(partition));
    Collections.sort(units);
    for (    String codeUnit : units) {
      List<Artifact> artifacts=ArtifactOperations.sortByParagraphNumbers(qualificationMethodToRequirements.getValues(codeUnit));
      processRow(sheetWriter,partition,codeUnit,artifacts);
    }
  }
}

Fixed version (ground truth):
@Override public void generateBody(ExcelXmlWriter sheetWriter) throws Exception {
  Collection<Artifact> directRequirements=source.getAllSwRequirements();
  HashCollection<String,Artifact> partitionMap=ArtifactOperations.sortByPartition(directRequirements);
  HashCollection<Artifact,String> requirementsToQualificationMethod=getQualificationMethods(source);
  HashCollection<String,String> partitionToQualificationMethod=new HashCollection<String,String>(false,TreeSet.class);
  HashCollection<String,Artifact> qualificationMethodToRequirements=new HashCollection<String,Artifact>(false,TreeSet.class);
  for (  String partition : partitionMap.keySet()) {
    for (    Artifact artifact : partitionMap.getValues(partition)) {
      Collection<String> values=requirementsToQualificationMethod.getValues(artifact);
      if (values != null) {
        for (        String codeUnit : values) {
          if (Strings.isValid(codeUnit)) {
            int index=codeUnit.lastIndexOf(File.separator);
            codeUnit=codeUnit.substring(index + 1,codeUnit.length());
          }
          partitionToQualificationMethod.put(partition,codeUnit);
          qualificationMethodToRequirements.put(codeUnit,artifact);
        }
      }
    }
  }
  for (  String partition : new TreeSet<String>(partitionToQualificationMethod.keySet())) {
    List<String> units=new ArrayList<>(partitionToQualificationMethod.getValues(partition));
    Collections.sort(units);
    for (    String codeUnit : units) {
      Set<Artifact> artifacts=new HashSet<>();
      for (      Artifact req : qualificationMethodToRequirements.getValues(codeUnit)) {
        List<String> attributeValues=req.getAttributeValues(CoreAttributeTypes.Partition);
        if (attributeValues.contains(partition)) {
          artifacts.add(req);
        }
      }
      processRow(sheetWriter,partition,codeUnit,ArtifactOperations.sortByParagraphNumbers(artifacts));
    }
  }
}