Program: 84745
Project: 84745
Buggy source:
@Override protected void buildSummary(HSSFSheet worksheet){
  List<HSSFCellStyle> cellStyles=buildCellStylesForSummary(worksheet);
  buildSummaryRow(worksheet,cellStyles,"String_Node_Str",DateUtil.today().toString("String_Node_Str"));
  buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
  List<String> patientDocumentIds=patientReports.getPatientDocIds();
  for (  String patientDocumentId : patientDocumentIds) {
    PatientReport report=patientReports.getPatientReport(patientDocumentId);
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",report.getPatientId());
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",report.getClinicName());
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",DateUtil.newDate(report.getARTStartedOn()).toString(TAMAConstants.DATE_FORMAT));
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    List<TreatmentAdvice> treatmentAdvices=allTreatmentAdvices.find_by_patient_id(report.getPatientDocId());
    Collections.sort(treatmentAdvices);
    for (    TreatmentAdvice treatmentAdvice : treatmentAdvices) {
      if (treatmentAdvice.getEndDate() == null)       buildSummaryRow(worksheet,cellStyles,allRegimens.get(treatmentAdvice.getRegimenId()).getDisplayName() + "String_Node_Str" + CURRENT_REGIMEN,DateUtil.newDate(treatmentAdvice.getStartDate()).toString(TAMAConstants.DATE_FORMAT));
 else       buildSummaryRow(worksheet,cellStyles,allRegimens.get(treatmentAdvice.getRegimenId()).getDisplayName(),DateUtil.newDate(treatmentAdvice.getStartDate()).toString(TAMAConstants.DATE_FORMAT));
    }
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    worksheet.createRow(worksheet.getLastRowNum() + 1);
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void buildSummary(HSSFSheet worksheet){
  List<HSSFCellStyle> cellStyles=buildCellStylesForSummary(worksheet);
  buildSummaryRow(worksheet,cellStyles,"String_Node_Str",DateUtil.today().toString("String_Node_Str"));
  buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
  List<String> patientDocumentIds=patientReports.getPatientDocIds();
  for (  String patientDocumentId : patientDocumentIds) {
    PatientReport report=patientReports.getPatientReport(patientDocumentId);
    String artStartDate=report.getARTStartedOn() != null ? DateUtil.newDate(report.getARTStartedOn()).toString(TAMAConstants.DATE_FORMAT) : null;
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",report.getPatientId());
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",report.getClinicName());
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str",artStartDate);
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    List<TreatmentAdvice> treatmentAdvices=allTreatmentAdvices.find_by_patient_id(report.getPatientDocId());
    Collections.sort(treatmentAdvices);
    for (    TreatmentAdvice treatmentAdvice : treatmentAdvices) {
      if (treatmentAdvice.getEndDate() == null)       buildSummaryRow(worksheet,cellStyles,allRegimens.get(treatmentAdvice.getRegimenId()).getDisplayName() + "String_Node_Str" + CURRENT_REGIMEN,DateUtil.newDate(treatmentAdvice.getStartDate()).toString(TAMAConstants.DATE_FORMAT));
 else       buildSummaryRow(worksheet,cellStyles,allRegimens.get(treatmentAdvice.getRegimenId()).getDisplayName(),DateUtil.newDate(treatmentAdvice.getStartDate()).toString(TAMAConstants.DATE_FORMAT));
    }
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
    worksheet.createRow(worksheet.getLastRowNum() + 1);
    buildSummaryRow(worksheet,cellStyles,"String_Node_Str","String_Node_Str");
  }
}