Program: 115159
Project: 115159
Buggy source:
public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy,ListNotesFilter filter,ListNotesSort sort){
  ArrayList<DiscrepancyNoteBean> discNotes=new ArrayList<DiscrepancyNoteBean>();
  setTypesExpected();
  this.setTypeExpected(12,TypeNames.STRING);
  this.setTypeExpected(13,TypeNames.INT);
  this.setTypeExpected(14,TypeNames.INT);
  this.setTypeExpected(15,TypeNames.INT);
  HashMap variables=new HashMap();
  variables.put(new Integer(1),currentStudy.getId());
  variables.put(new Integer(2),currentStudy.getId());
  variables.put(new Integer(3),currentStudy.getId());
  variables.put(new Integer(4),currentStudy.getId());
  variables.put(new Integer(5),currentStudy.getId());
  variables.put(new Integer(6),currentStudy.getId());
  variables.put(new Integer(7),currentStudy.getId());
  variables.put(new Integer(8),currentStudy.getId());
  variables.put(new Integer(9),currentStudy.getId());
  variables.put(new Integer(10),currentStudy.getId());
  String sql="String_Node_Str";
  sql=sql + digester.getQuery("String_Node_Str");
  sql=sql + filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  if (currentStudy.isSite(currentStudy.getParentStudyId())) {
    sql+="String_Node_Str" + this.findSiteHiddenEventCrfIdsString(currentStudy) + "String_Node_Str";
  }
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  if (currentStudy.isSite(currentStudy.getParentStudyId())) {
    sql+="String_Node_Str" + this.findSiteHiddenEventCrfIdsString(currentStudy) + "String_Node_Str";
  }
  sql+=filter.execute("String_Node_Str");
  ArrayList rows=select(sql,variables);
  Iterator it=rows.iterator();
  while (it.hasNext()) {
    DiscrepancyNoteBean discBean=(DiscrepancyNoteBean)this.getEntityFromHashMap((HashMap)it.next());
    discBean=findSingleMapping(discBean);
    discNotes.add(discBean);
  }
  return discNotes;
}

Fixed version (ground truth):
public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy,ListNotesFilter filter,ListNotesSort sort){
  ArrayList<DiscrepancyNoteBean> discNotes=new ArrayList<DiscrepancyNoteBean>();
  setTypesExpected();
  this.setTypeExpected(12,TypeNames.STRING);
  this.setTypeExpected(13,TypeNames.INT);
  this.setTypeExpected(14,TypeNames.INT);
  this.setTypeExpected(15,TypeNames.INT);
  HashMap variables=new HashMap();
  variables.put(new Integer(1),currentStudy.getId());
  variables.put(new Integer(2),currentStudy.getId());
  variables.put(new Integer(3),currentStudy.getId());
  variables.put(new Integer(4),currentStudy.getId());
  variables.put(new Integer(5),currentStudy.getId());
  variables.put(new Integer(6),currentStudy.getId());
  variables.put(new Integer(7),currentStudy.getId());
  variables.put(new Integer(8),currentStudy.getId());
  variables.put(new Integer(9),currentStudy.getId());
  variables.put(new Integer(10),currentStudy.getId());
  String sql="String_Node_Str";
  sql=sql + digester.getQuery("String_Node_Str");
  sql=sql + filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  if (currentStudy.isSite(currentStudy.getParentStudyId())) {
    sql+="String_Node_Str" + this.findSiteHiddenEventCrfIdsString(currentStudy) + "String_Node_Str";
  }
  sql+=filter.execute("String_Node_Str");
  sql+="String_Node_Str";
  sql+=digester.getQuery("String_Node_Str");
  if (currentStudy.isSite(currentStudy.getParentStudyId())) {
    sql+="String_Node_Str" + this.findSiteHiddenEventCrfIdsString(currentStudy) + "String_Node_Str";
  }
  sql+=filter.execute("String_Node_Str");
  sql+=sort.execute("String_Node_Str");
  ArrayList rows=select(sql,variables);
  Iterator it=rows.iterator();
  while (it.hasNext()) {
    DiscrepancyNoteBean discBean=(DiscrepancyNoteBean)this.getEntityFromHashMap((HashMap)it.next());
    discBean=findSingleMapping(discBean);
    discNotes.add(discBean);
  }
  return discNotes;
}