Program: 84760
Project: 84760
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseBody public String list(@RequestParam("String_Node_Str") String patientDocId,@RequestParam("String_Node_Str") Integer rangeInMonths) throws JSONException {
  LocalDate today=DateUtil.today().plusDays(1);
  LocalDate from=today.minusMonths(rangeInMonths);
  List<SymptomReport> symptomReports=allSymptomReports.getSymptomReports(patientDocId,from,today);
  JSONArray events=new JSONArray();
  Map<String,DateTime> lastReportedAtMap=new HashMap<String,DateTime>();
  TrackNumberGenerator trackNumberGenerator=new TrackNumberGenerator();
  for (int i=symptomReports.size() - 1; i >= 0; i--) {
    SymptomReport report=symptomReports.get(i);
    for (    String symptomId : report.getSymptomIds()) {
      JSONObject event=new JSONObject();
      event.put("String_Node_Str",String.format("String_Node_Str",report.getReportedAt()));
      if (lastReportedAtMap.get(symptomId) == null || report.getReportedAt().isBefore(lastReportedAtMap.get(symptomId).minusDays(7)))       event.put("String_Node_Str",symptomReportingProperties.symptomLabel(symptomId));
      event.put("String_Node_Str",false);
      event.put("String_Node_Str",trackNumberGenerator.trackNumberFor(symptomId));
      event.put("String_Node_Str",symptomReportingProperties.symptomDescription(symptomId));
      events.put(event);
      lastReportedAtMap.put(symptomId,report.getReportedAt());
    }
  }
  JSONObject result=new JSONObject();
  result.put("String_Node_Str",events);
  result.put("String_Node_Str","String_Node_Str");
  return result.toString();
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseBody public String list(@RequestParam("String_Node_Str") String patientDocId,@RequestParam("String_Node_Str") Integer rangeInMonths) throws JSONException {
  LocalDate today=DateUtil.today().plusDays(1);
  LocalDate from=today.minusMonths(rangeInMonths);
  List<SymptomReport> symptomReports=allSymptomReports.getSymptomReports(patientDocId,from,today);
  JSONArray events=new JSONArray();
  Map<String,DateTime> lastReportedAtMap=new HashMap<String,DateTime>();
  TrackNumberGenerator trackNumberGenerator=new TrackNumberGenerator();
  for (int i=symptomReports.size() - 1; i >= 0; i--) {
    SymptomReport report=symptomReports.get(i);
    for (    String symptomId : report.getSymptomIds()) {
      JSONObject event=new JSONObject();
      event.put("String_Node_Str",String.format("String_Node_Str",report.getReportedAt().toLocalDateTime()));
      if (lastReportedAtMap.get(symptomId) == null || report.getReportedAt().isBefore(lastReportedAtMap.get(symptomId).minusDays(7)))       event.put("String_Node_Str",symptomReportingProperties.symptomLabel(symptomId));
      event.put("String_Node_Str",false);
      event.put("String_Node_Str",trackNumberGenerator.trackNumberFor(symptomId));
      event.put("String_Node_Str",symptomReportingProperties.symptomDescription(symptomId));
      events.put(event);
      lastReportedAtMap.put(symptomId,report.getReportedAt());
    }
  }
  JSONObject result=new JSONObject();
  result.put("String_Node_Str",events);
  result.put("String_Node_Str","String_Node_Str");
  return result.toString();
}