Program: 115287
Project: 115287
Buggy source:
public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy,ListNotesFilter filter,ListNotesSort sort,int rowStart,int rowEnd){
  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";
  if ("String_Node_Str".equalsIgnoreCase(CoreResources.getDBName())) {
    sql=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");
  if ("String_Node_Str".equalsIgnoreCase(CoreResources.getDBName())) {
    sql+="String_Node_Str" + (rowStart + 1) + "String_Node_Str"+ rowEnd;
    sql+=sort.execute("String_Node_Str");
  }
 else {
    sql+=sort.execute("String_Node_Str");
    sql+="String_Node_Str" + (rowEnd - rowStart) + "String_Node_Str"+ rowStart;
  }
  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";
  if ("String_Node_Str".equalsIgnoreCase(CoreResources.getDBName())) {
    sql=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;
}