Program: 115203
Project: 115203
Buggy source:
protected void setDataWithOCAttributes(StudyBean study,DatasetBean dataset,OdmClinicalDataBean data,String odmVersion,Iterator iter,HashMap<Integer,String> oidPoses,String odmType){
  String subprev="String_Node_Str";
  HashMap<String,Integer> sepos=new HashMap<String,Integer>();
  String seprev="String_Node_Str";
  String formprev="String_Node_Str";
  HashMap<String,Integer> igpos=new HashMap<String,Integer>();
  String igprev="String_Node_Str";
  String oidPos="String_Node_Str";
  StudyBean parentStudy=study.getParentStudyId() > 0 ? (StudyBean)new StudyDAO(this.ds).findByPK(study.getParentStudyId()) : study;
  setStudyParemeterConfig(parentStudy);
  HashSet<Integer> sgcIdSet=new HashSet<Integer>();
  HashMap<String,String> subOidPoses=new HashMap<String,String>();
  HashMap<String,String> evnOidPoses=new HashMap<String,String>();
  String studySubjectOids="String_Node_Str";
  String sedOids="String_Node_Str";
  String ecIds="String_Node_Str";
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    String studySubjectLabel=(String)row.get("String_Node_Str");
    Integer sgcId=(Integer)row.get("String_Node_Str");
    String sgcName=(String)row.get("String_Node_Str");
    String sgName=(String)row.get("String_Node_Str");
    String sedOID=(String)row.get("String_Node_Str");
    Boolean studyEventRepeating=(Boolean)row.get("String_Node_Str");
    Integer sampleOrdinal=(Integer)row.get("String_Node_Str");
    Date startDate=(Date)row.get("String_Node_Str");
    String cvOID=(String)row.get("String_Node_Str");
    Integer ecId=(Integer)row.get("String_Node_Str");
    Date dob=(Date)row.get("String_Node_Str");
    String key=studySubjectLabel;
    ExportSubjectDataBean sub=new ExportSubjectDataBean();
    if (subprev.equals(studySubjectLabel)) {
      int p=data.getExportSubjectData().size() - 1;
      sub=data.getExportSubjectData().get(p);
      if (sgcId > 0) {
        int presize=sgcIdSet.size();
        sgcIdSet.add(sgcId);
        if (sgcIdSet.size() > presize) {
          sgcIdSet.add(sgcId);
          SubjectGroupDataBean sgd=new SubjectGroupDataBean();
          sgd.setStudyGroupClassId("String_Node_Str" + sgcId);
          sgd.setStudyGroupClassName(sgcName);
          sgd.setStudyGroupName(sgName);
          sub.getSubjectGroupData().add(sgd);
        }
      }
    }
 else {
      subprev=studySubjectLabel;
      studySubjectOids+="String_Node_Str" + studySubjectLabel + "String_Node_Str";
      sub.setSubjectOID(studySubjectLabel);
      sub.setStudySubjectId((String)row.get("String_Node_Str"));
      if (dataset.isShowSubjectUniqueIdentifier()) {
        sub.setUniqueIdentifier((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowSubjectSecondaryId()) {
        sub.setSecondaryId((String)row.get("String_Node_Str"));
      }
      if (dob != null) {
        if (dataset.isShowSubjectDob()) {
          if (parentStudy.getStudyParameterConfig().getCollectDob().equals("String_Node_Str")) {
            Calendar cal=Calendar.getInstance();
            cal.setTime(dob);
            int year=cal.get(Calendar.YEAR);
            if (year > 0) {
              sub.setYearOfBirth(year);
            }
          }
 else {
            sub.setDateOfBirth(new SimpleDateFormat("String_Node_Str").format(dob));
          }
        }
      }
      if (dataset.isShowSubjectGender()) {
        sub.setSubjectGender((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowSubjectStatus()) {
        sub.setStatus(Status.get((Integer)row.get("String_Node_Str")).getName());
      }
      if (sgcId > 0) {
        sgcIdSet.clear();
        sgcIdSet.add(sgcId);
        SubjectGroupDataBean sgd=new SubjectGroupDataBean();
        sgd.setStudyGroupClassId("String_Node_Str" + sgcId);
        sgd.setStudyGroupClassName(sgcName);
        sgd.setStudyGroupName(sgName);
        sub.getSubjectGroupData().add(sgd);
      }
      data.getExportSubjectData().add(sub);
      seprev="String_Node_Str";
      formprev="String_Node_Str";
      igprev="String_Node_Str";
    }
    oidPos=data.getExportSubjectData().size() - 1 + "String_Node_Str";
    subOidPoses.put(studySubjectLabel,oidPos);
    ExportStudyEventDataBean se=new ExportStudyEventDataBean();
    key+=sedOID;
    if (!seprev.equals(key) || !sepos.containsKey(key + sampleOrdinal)) {
      sepos.put(key + sampleOrdinal,sub.getExportStudyEventData().size());
      seprev=key;
      sedOids+="String_Node_Str" + sedOID + "String_Node_Str";
      se.setStudyEventOID(sedOID);
      if (startDate != null && dataset.isShowSubjectAgeAtEvent() && dob != null) {
        se.setAgeAtEvent(Utils.getAge(dob,startDate));
      }
      if (dataset.isShowEventLocation()) {
        se.setLocation((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowEventStart() && startDate != null) {
        if ((Boolean)row.get("String_Node_Str") == Boolean.TRUE) {
          se.setStartDate(new SimpleDateFormat("String_Node_Str").format(startDate));
        }
 else {
          se.setStartDate(new SimpleDateFormat("String_Node_Str").format(startDate));
        }
      }
      Date endDate=(Date)row.get("String_Node_Str");
      if (dataset.isShowEventEnd() && endDate != null) {
        if ((Boolean)row.get("String_Node_Str") == Boolean.TRUE) {
          se.setEndDate(new SimpleDateFormat("String_Node_Str").format(endDate));
        }
 else {
          se.setEndDate(new SimpleDateFormat("String_Node_Str").format(endDate));
        }
      }
      if (dataset.isShowEventStatus()) {
        se.setStatus(SubjectEventStatus.get((Integer)row.get("String_Node_Str")).getName());
      }
      se.setStudyEventRepeatKey(studyEventRepeating ? sampleOrdinal + "String_Node_Str" : "String_Node_Str");
      sub.getExportStudyEventData().add(se);
      formprev="String_Node_Str";
      igprev="String_Node_Str";
    }
 else {
      se=sub.getExportStudyEventData().get(sepos.get(key + sampleOrdinal));
    }
    oidPos+="String_Node_Str" + (sub.getExportStudyEventData().size() - 1);
    evnOidPoses.put(key,oidPos);
    ExportFormDataBean form=new ExportFormDataBean();
    key+=cvOID;
    if (formprev.equals(key)) {
      form=se.getExportFormData().get(se.getExportFormData().size() - 1);
    }
 else {
      formprev=key;
      ecIds+="String_Node_Str" + ecId + "String_Node_Str";
      form.setFormOID(cvOID);
      if (dataset.isShowCRFversion()) {
        form.setCrfVersion((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowCRFstatus()) {
        form.setStatus(this.getCrfVersionStatus(se.getStatus(),(Integer)row.get("String_Node_Str"),(Integer)row.get("String_Node_Str"),(Integer)row.get("String_Node_Str")));
      }
      if (dataset.isShowCRFinterviewerName()) {
        form.setInterviewerName((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowCRFinterviewerDate()) {
        try {
          form.setInterviewDate(new SimpleDateFormat("String_Node_Str").format((Date)row.get("String_Node_Str")));
        }
 catch (        NullPointerException npe) {
          logger.info("String_Node_Str");
          form.setInterviewDate(new SimpleDateFormat("String_Node_Str").format(new Date()));
        }
      }
      se.getExportFormData().add(form);
      igprev="String_Node_Str";
    }
    oidPos+="String_Node_Str" + (se.getExportFormData().size() - 1);
    oidPoses.put(ecId,oidPos);
    oidPos="String_Node_Str";
  }
  studySubjectOids=studySubjectOids.length() > 0 ? studySubjectOids.substring(0,studySubjectOids.length() - 2).trim() : studySubjectOids;
  sedOids=sedOids.length() > 0 ? sedOids.substring(0,sedOids.length() - 2).trim() : sedOids;
  ecIds=ecIds.length() > 0 ? ecIds.substring(0,ecIds.length() - 2).trim() : ecIds;
  if (odmType != null && odmType.equalsIgnoreCase("String_Node_Str")) {
    System.out.println("String_Node_Str");
  }
 else {
    if (studySubjectOids.length() > 0) {
      this.setOCSubjectDataAuditLogs(parentStudy,data,studySubjectOids,subOidPoses);
      this.setOCEventDataAuditLogs(parentStudy,data,studySubjectOids,evnOidPoses);
      if (ecIds.length() > 0) {
        this.setOCFormDataAuditLogs(parentStudy,data,studySubjectOids,ecIds,oidPoses);
      }
 else {
        logger.info("String_Node_Str");
      }
      this.setOCSubjectDataDNs(data,studySubjectOids,subOidPoses);
      if (sedOids.length() > 0) {
        this.setOCEventDataDNs(data,sedOids,studySubjectOids,evnOidPoses);
      }
 else {
        logger.info("String_Node_Str");
      }
    }
 else {
      logger.info("String_Node_Str" + "String_Node_Str");
    }
    if (ecIds.length() > 0) {
      this.setOCFormDataDNs(data,ecIds,oidPoses);
    }
 else {
      logger.info("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
protected void setDataWithOCAttributes(StudyBean study,DatasetBean dataset,OdmClinicalDataBean data,String odmVersion,Iterator iter,HashMap<Integer,String> oidPoses,String odmType){
  String subprev="String_Node_Str";
  HashMap<String,Integer> sepos=new HashMap<String,Integer>();
  String seprev="String_Node_Str";
  String formprev="String_Node_Str";
  HashMap<String,Integer> igpos=new HashMap<String,Integer>();
  String igprev="String_Node_Str";
  String oidPos="String_Node_Str";
  StudyBean parentStudy=study.getParentStudyId() > 0 ? (StudyBean)new StudyDAO(this.ds).findByPK(study.getParentStudyId()) : study;
  setStudyParemeterConfig(parentStudy);
  HashSet<Integer> sgcIdSet=new HashSet<Integer>();
  HashMap<String,String> subOidPoses=new HashMap<String,String>();
  HashMap<String,String> evnOidPoses=new HashMap<String,String>();
  String studySubjectOids="String_Node_Str";
  String sedOids="String_Node_Str";
  String ecIds="String_Node_Str";
  while (iter.hasNext()) {
    HashMap row=(HashMap)iter.next();
    String studySubjectLabel=(String)row.get("String_Node_Str");
    Integer sgcId=(Integer)row.get("String_Node_Str");
    String sgcName=(String)row.get("String_Node_Str");
    String sgName=(String)row.get("String_Node_Str");
    String sedOID=(String)row.get("String_Node_Str");
    Boolean studyEventRepeating=(Boolean)row.get("String_Node_Str");
    Integer sampleOrdinal=(Integer)row.get("String_Node_Str");
    Date startDate=(Date)row.get("String_Node_Str");
    String cvOID=(String)row.get("String_Node_Str");
    Integer ecId=(Integer)row.get("String_Node_Str");
    Date dob=(Date)row.get("String_Node_Str");
    String key=studySubjectLabel;
    ExportSubjectDataBean sub=new ExportSubjectDataBean();
    if (subprev.equals(studySubjectLabel)) {
      int p=data.getExportSubjectData().size() - 1;
      sub=data.getExportSubjectData().get(p);
      if (sgcId > 0) {
        int presize=sgcIdSet.size();
        sgcIdSet.add(sgcId);
        if (sgcIdSet.size() > presize) {
          sgcIdSet.add(sgcId);
          SubjectGroupDataBean sgd=new SubjectGroupDataBean();
          sgd.setStudyGroupClassId("String_Node_Str" + sgcId);
          sgd.setStudyGroupClassName(sgcName);
          sgd.setStudyGroupName(sgName);
          sub.getSubjectGroupData().add(sgd);
        }
      }
    }
 else {
      subprev=studySubjectLabel;
      studySubjectOids+="String_Node_Str" + studySubjectLabel + "String_Node_Str";
      sub.setSubjectOID(studySubjectLabel);
      sub.setStudySubjectId((String)row.get("String_Node_Str"));
      if (dataset.isShowSubjectUniqueIdentifier()) {
        sub.setUniqueIdentifier((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowSubjectSecondaryId()) {
        sub.setSecondaryId((String)row.get("String_Node_Str"));
      }
      if (dob != null) {
        if (dataset.isShowSubjectDob()) {
          if (parentStudy.getStudyParameterConfig().getCollectDob().equals("String_Node_Str")) {
            Calendar cal=Calendar.getInstance();
            cal.setTime(dob);
            int year=cal.get(Calendar.YEAR);
            if (year > 0) {
              sub.setYearOfBirth(year);
            }
          }
 else {
            sub.setDateOfBirth(new SimpleDateFormat("String_Node_Str").format(dob));
          }
        }
      }
      if (dataset.isShowSubjectGender()) {
        sub.setSubjectGender((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowSubjectStatus()) {
        sub.setStatus(Status.get((Integer)row.get("String_Node_Str")).getName());
      }
      if (sgcId > 0) {
        sgcIdSet.clear();
        sgcIdSet.add(sgcId);
        SubjectGroupDataBean sgd=new SubjectGroupDataBean();
        sgd.setStudyGroupClassId("String_Node_Str" + sgcId);
        sgd.setStudyGroupClassName(sgcName);
        sgd.setStudyGroupName(sgName);
        sub.getSubjectGroupData().add(sgd);
      }
      data.getExportSubjectData().add(sub);
      seprev="String_Node_Str";
      formprev="String_Node_Str";
      igprev="String_Node_Str";
    }
    oidPos=data.getExportSubjectData().size() - 1 + "String_Node_Str";
    subOidPoses.put(studySubjectLabel,oidPos);
    ExportStudyEventDataBean se=new ExportStudyEventDataBean();
    key+=sedOID;
    if (!seprev.equals(key) || !sepos.containsKey(key + sampleOrdinal)) {
      sepos.put(key + sampleOrdinal,sub.getExportStudyEventData().size());
      seprev=key;
      sedOids+="String_Node_Str" + sedOID + "String_Node_Str";
      se.setStudyEventOID(sedOID);
      if (startDate != null && dataset.isShowSubjectAgeAtEvent() && dob != null) {
        se.setAgeAtEvent(Utils.getAge(dob,startDate));
      }
      if (dataset.isShowEventLocation()) {
        se.setLocation((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowEventStart() && startDate != null) {
        if ((Boolean)row.get("String_Node_Str") == Boolean.TRUE) {
          se.setStartDate(new SimpleDateFormat("String_Node_Str").format(startDate));
        }
 else {
          se.setStartDate(new SimpleDateFormat("String_Node_Str").format(startDate));
        }
      }
      Date endDate=(Date)row.get("String_Node_Str");
      if (dataset.isShowEventEnd() && endDate != null) {
        if ((Boolean)row.get("String_Node_Str") == Boolean.TRUE) {
          se.setEndDate(new SimpleDateFormat("String_Node_Str").format(endDate));
        }
 else {
          se.setEndDate(new SimpleDateFormat("String_Node_Str").format(endDate));
        }
      }
      if (dataset.isShowEventStatus()) {
        se.setStatus(SubjectEventStatus.get((Integer)row.get("String_Node_Str")).getName());
      }
      se.setStudyEventRepeatKey(studyEventRepeating ? sampleOrdinal + "String_Node_Str" : "String_Node_Str");
      sub.getExportStudyEventData().add(se);
      formprev="String_Node_Str";
      igprev="String_Node_Str";
    }
 else {
      se=sub.getExportStudyEventData().get(sepos.get(key + sampleOrdinal));
    }
    oidPos+="String_Node_Str" + (sub.getExportStudyEventData().size() - 1);
    evnOidPoses.put(key,oidPos);
    ExportFormDataBean form=new ExportFormDataBean();
    key+=cvOID;
    if (formprev.equals(key)) {
      form=se.getExportFormData().get(se.getExportFormData().size() - 1);
    }
 else {
      formprev=key;
      ecIds+="String_Node_Str" + ecId + "String_Node_Str";
      form.setFormOID(cvOID);
      if (dataset.isShowCRFversion()) {
        form.setCrfVersion((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowCRFstatus()) {
        form.setStatus(this.getCrfVersionStatus(se.getStatus(),(Integer)row.get("String_Node_Str"),(Integer)row.get("String_Node_Str"),(Integer)row.get("String_Node_Str")));
      }
      if (dataset.isShowCRFinterviewerName()) {
        form.setInterviewerName((String)row.get("String_Node_Str"));
      }
      if (dataset.isShowCRFinterviewerDate()) {
        try {
          form.setInterviewDate(new SimpleDateFormat("String_Node_Str").format((Date)row.get("String_Node_Str")));
        }
 catch (        NullPointerException npe) {
          logger.info("String_Node_Str");
          form.setInterviewDate(new SimpleDateFormat("String_Node_Str").format(new Date()));
        }
      }
      se.getExportFormData().add(form);
      igprev="String_Node_Str";
    }
    oidPos+="String_Node_Str" + (se.getExportFormData().size() - 1);
    oidPoses.put(ecId,oidPos);
    oidPos="String_Node_Str";
  }
  studySubjectOids=studySubjectOids.length() > 0 ? studySubjectOids.substring(0,studySubjectOids.length() - 2).trim() : studySubjectOids;
  sedOids=sedOids.length() > 0 ? sedOids.substring(0,sedOids.length() - 2).trim() : sedOids;
  ecIds=ecIds.length() > 0 ? ecIds.substring(0,ecIds.length() - 2).trim() : ecIds;
  if (odmType != null && odmType.equalsIgnoreCase("String_Node_Str")) {
    logger.debug("String_Node_Str");
  }
 else {
    if (studySubjectOids.length() > 0) {
      this.setOCSubjectDataAuditLogs(parentStudy,data,studySubjectOids,subOidPoses);
      this.setOCEventDataAuditLogs(parentStudy,data,studySubjectOids,evnOidPoses);
      if (ecIds.length() > 0) {
        this.setOCFormDataAuditLogs(parentStudy,data,studySubjectOids,ecIds,oidPoses);
      }
 else {
        logger.debug("String_Node_Str");
      }
      this.setOCSubjectDataDNs(data,studySubjectOids,subOidPoses);
      if (sedOids.length() > 0) {
        this.setOCEventDataDNs(data,sedOids,studySubjectOids,evnOidPoses);
      }
 else {
        logger.info("String_Node_Str");
      }
    }
 else {
      logger.debug("String_Node_Str" + "String_Node_Str");
    }
    if (ecIds.length() > 0) {
      this.setOCFormDataDNs(data,ecIds,oidPoses);
    }
 else {
      logger.debug("String_Node_Str");
    }
  }
}