Program: 115206
Project: 115206
Buggy source:
protected void setOCFormDataDNs(OdmClinicalDataBean data,String ecIds,HashMap<Integer,String> formOidPoses){
  this.setOCFormDataDNsTypesExpected();
  HashMap<String,ArrayList<ChildNoteBean>> pDNs=new HashMap<String,ArrayList<ChildNoteBean>>();
  HashMap<String,ArrayList<DiscrepancyNoteBean>> sDNs=new HashMap<String,ArrayList<DiscrepancyNoteBean>>();
  logger.debug("String_Node_Str");
  logger.error("String_Node_Str" + this.getOCFormDataDNsSql(ecIds));
  ArrayList rows=select(this.getOCFormDataDNsSql(ecIds));
  Iterator iter=rows.iterator();
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    Integer ecId=(Integer)row.get("String_Node_Str");
    Integer pdnId=(Integer)row.get("String_Node_Str");
    Integer dnId=(Integer)row.get("String_Node_Str");
    String description=(String)row.get("String_Node_Str");
    String detailedNote=(String)row.get("String_Node_Str");
    Integer ownerId=(Integer)row.get("String_Node_Str");
    Date dateCreated=(Date)row.get("String_Node_Str");
    String status=(String)row.get("String_Node_Str");
    String noteType=(String)row.get("String_Node_Str");
    if (pdnId != null && pdnId > 0) {
      String key=ecId + "String_Node_Str" + pdnId;
      ChildNoteBean cn=new ChildNoteBean();
      cn.setDateCreated(dateCreated);
      cn.setDescription(description);
      cn.setDetailedNote(detailedNote);
      cn.setStatus(status);
      cn.setOid("String_Node_Str" + dnId);
      ElementRefBean userRef=new ElementRefBean();
      userRef.setElementDefOID("String_Node_Str" + ownerId);
      cn.setUserRef(userRef);
      ArrayList<ChildNoteBean> cns=pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
      cns.add(cn);
      pDNs.put(key,cns);
    }
 else {
      DiscrepancyNoteBean dn=new DiscrepancyNoteBean();
      String k=ecId + "String_Node_Str" + dnId;
      if (pDNs != null && pDNs.containsKey(k)) {
        dn.setChildNotes(pDNs.get(k));
        dn.setNumberOfChildNotes(dn.getChildNotes().size());
      }
      dn.setDateUpdated(dateCreated);
      dn.setNoteType(noteType);
      dn.setStatus(status);
      dn.setOid("String_Node_Str" + dnId);
      ElementRefBean userRef=new ElementRefBean();
      userRef.setElementDefOID("String_Node_Str" + ownerId);
      if (formOidPoses.containsKey(ecId)) {
        String[] poses=formOidPoses.get(ecId).split("String_Node_Str");
        int p0=Integer.parseInt(poses[0]);
        int p1=Integer.parseInt(poses[1]);
        int p2=Integer.parseInt(poses[2]);
        String entityID=data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getFormOID();
        data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().setEntityID(entityID);
        data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
      }
    }
  }
}

Fixed version (ground truth):
protected void setOCFormDataDNs(OdmClinicalDataBean data,String ecIds,HashMap<Integer,String> formOidPoses){
  this.setOCFormDataDNsTypesExpected();
  HashMap<String,ArrayList<ChildNoteBean>> pDNs=new HashMap<String,ArrayList<ChildNoteBean>>();
  HashMap<String,ArrayList<DiscrepancyNoteBean>> sDNs=new HashMap<String,ArrayList<DiscrepancyNoteBean>>();
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str" + this.getOCFormDataDNsSql(ecIds));
  ArrayList rows=select(this.getOCFormDataDNsSql(ecIds));
  Iterator iter=rows.iterator();
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    Integer ecId=(Integer)row.get("String_Node_Str");
    Integer pdnId=(Integer)row.get("String_Node_Str");
    Integer dnId=(Integer)row.get("String_Node_Str");
    String description=(String)row.get("String_Node_Str");
    String detailedNote=(String)row.get("String_Node_Str");
    Integer ownerId=(Integer)row.get("String_Node_Str");
    Date dateCreated=(Date)row.get("String_Node_Str");
    String status=(String)row.get("String_Node_Str");
    String noteType=(String)row.get("String_Node_Str");
    if (pdnId != null && pdnId > 0) {
      String key=ecId + "String_Node_Str" + pdnId;
      ChildNoteBean cn=new ChildNoteBean();
      cn.setDateCreated(dateCreated);
      cn.setDescription(description);
      cn.setDetailedNote(detailedNote);
      cn.setStatus(status);
      cn.setOid("String_Node_Str" + dnId);
      ElementRefBean userRef=new ElementRefBean();
      userRef.setElementDefOID("String_Node_Str" + ownerId);
      cn.setUserRef(userRef);
      ArrayList<ChildNoteBean> cns=pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
      cns.add(cn);
      pDNs.put(key,cns);
    }
 else {
      DiscrepancyNoteBean dn=new DiscrepancyNoteBean();
      String k=ecId + "String_Node_Str" + dnId;
      if (pDNs != null && pDNs.containsKey(k)) {
        dn.setChildNotes(pDNs.get(k));
        dn.setNumberOfChildNotes(dn.getChildNotes().size());
      }
      dn.setDateUpdated(dateCreated);
      dn.setNoteType(noteType);
      dn.setStatus(status);
      dn.setOid("String_Node_Str" + dnId);
      ElementRefBean userRef=new ElementRefBean();
      userRef.setElementDefOID("String_Node_Str" + ownerId);
      if (formOidPoses.containsKey(ecId)) {
        String[] poses=formOidPoses.get(ecId).split("String_Node_Str");
        int p0=Integer.parseInt(poses[0]);
        int p1=Integer.parseInt(poses[1]);
        int p2=Integer.parseInt(poses[2]);
        String entityID=data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getFormOID();
        data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().setEntityID(entityID);
        data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
      }
    }
  }
}