Program: 115214
Project: 115214
Buggy source:
protected void setOCSubjectDataDNs(OdmClinicalDataBean data,String studySubjectOids,HashMap<String,String> subOidPoses){
  this.setOCSubjectDataDNsTypesExpected();
  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.getOCSubjectDataDNsSql(studySubjectOids));
  ArrayList rows=select(this.getOCSubjectDataDNsSql(studySubjectOids));
  Iterator iter=rows.iterator();
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    String studySubjectLabel=(String)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=studySubjectLabel + "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=studySubjectLabel + "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 (subOidPoses.containsKey(studySubjectLabel)) {
        int i=Integer.parseInt(subOidPoses.get(studySubjectLabel));
        String entityID=data.getExportSubjectData().get(i).getSubjectOID();
        data.getExportSubjectData().get(i).getDiscrepancyNotes().setEntityID(entityID);
        data.getExportSubjectData().get(i).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
      }
    }
  }
}

Fixed version (ground truth):
protected void setOCSubjectDataDNs(OdmClinicalDataBean data,String studySubjectOids,HashMap<String,String> subOidPoses){
  this.setOCSubjectDataDNsTypesExpected();
  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.getOCSubjectDataDNsSql(studySubjectOids));
  ArrayList rows=select(this.getOCSubjectDataDNsSql(studySubjectOids));
  Iterator iter=rows.iterator();
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    String studySubjectLabel=(String)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=studySubjectLabel + "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=studySubjectLabel + "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 (subOidPoses.containsKey(studySubjectLabel)) {
        int i=Integer.parseInt(subOidPoses.get(studySubjectLabel));
        String entityID=data.getExportSubjectData().get(i).getSubjectOID();
        data.getExportSubjectData().get(i).getDiscrepancyNotes().setEntityID(entityID);
        data.getExportSubjectData().get(i).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
      }
    }
  }
}