Program: 115213
Project: 115213
Buggy source:
public void getClinicalData(StudyBean study,DatasetBean dataset,OdmClinicalDataBean data,String odmVersion,String studySubjectIds,String odmType){
  String dbName=CoreResources.getDBName();
  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";
  HashMap<Integer,String> oidPoses=new HashMap<Integer,String>();
  HashMap<Integer,String> idataOidPoses=new HashMap<Integer,String>();
  String studyIds=study.getId() + "String_Node_Str";
  int datasetItemStatusId=dataset.getDatasetItemStatus().getId();
  String sql=dataset.getSQLStatement().split("String_Node_Str")[0].trim();
  sql=sql.split("String_Node_Str")[1];
  String[] ss=sql.split("String_Node_Str");
  String sedIds=ss[0];
  String[] sss=ss[1].split("String_Node_Str");
  String itemIds=sss[0];
  String dateConstraint="String_Node_Str";
  if ("String_Node_Str".equalsIgnoreCase(dbName)) {
    dateConstraint="String_Node_Str" + sss[1] + "String_Node_Str"+ sss[2];
    dateConstraint=dateConstraint.replace("String_Node_Str","String_Node_Str");
  }
 else   if ("String_Node_Str".equalsIgnoreCase(dbName)) {
    String[] os=(sss[1] + sss[2]).split("String_Node_Str");
    dateConstraint="String_Node_Str" + os[1] + "String_Node_Str"+ os[3]+ "String_Node_Str";
  }
  logger.debug("String_Node_Str");
  if (odmVersion.startsWith("String_Node_Str")) {
    logger.error("String_Node_Str" + getOCSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    this.setSubjectEventFormDataTypesExpected(odmVersion);
    ArrayList viewRows=select(getOCSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    Iterator iter=viewRows.iterator();
    this.setDataWithOCAttributes(study,dataset,data,odmVersion,iter,oidPoses,odmType);
  }
 else {
    logger.error("String_Node_Str" + getSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    this.setSubjectEventFormDataTypesExpected();
    ArrayList viewRows=select(getSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    Iterator iter=viewRows.iterator();
    while (iter.hasNext()) {
      HashMap row=(HashMap)iter.next();
      String studySubjectLabel=(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");
      String cvOID=(String)row.get("String_Node_Str");
      Integer ecId=(Integer)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);
      }
 else {
        subprev=studySubjectLabel;
        sub.setSubjectOID(studySubjectLabel);
        data.getExportSubjectData().add(sub);
        seprev="String_Node_Str";
        formprev="String_Node_Str";
        igprev="String_Node_Str";
      }
      oidPos=data.getExportSubjectData().size() - 1 + "String_Node_Str";
      ExportStudyEventDataBean se=new ExportStudyEventDataBean();
      key+=sedOID;
      if (!seprev.equals(key) || !sepos.containsKey(key + sampleOrdinal)) {
        sepos.put(key + sampleOrdinal,sub.getExportStudyEventData().size());
        seprev=key;
        se.setStudyEventOID(sedOID);
        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);
      ExportFormDataBean form=new ExportFormDataBean();
      key+=cvOID;
      if (formprev.equals(key)) {
        form=se.getExportFormData().get(se.getExportFormData().size() - 1);
      }
 else {
        formprev=key;
        form.setFormOID(cvOID);
        se.getExportFormData().add(form);
        igprev="String_Node_Str";
      }
      oidPos+="String_Node_Str" + (se.getExportFormData().size() - 1);
      oidPoses.put(ecId,oidPos);
      oidPos="String_Node_Str";
    }
  }
  this.setEventGroupItemDataWithUnitTypesExpected();
  logger.debug("String_Node_Str");
  ArrayList viewRows=select(getEventGroupItemWithUnitSql(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
  logger.error("String_Node_Str" + getEventGroupItemWithUnitSql(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
  String idataIds="String_Node_Str";
  if (viewRows.size() > 0) {
    Iterator iter=viewRows.iterator();
    ExportSubjectDataBean sub=new ExportSubjectDataBean();
    ExportStudyEventDataBean se=new ExportStudyEventDataBean();
    ExportFormDataBean form=new ExportFormDataBean();
    int ecprev=-1;
    igprev="String_Node_Str";
    boolean goon=true;
    String itprev="String_Node_Str";
    HashMap<String,String> nullValueCVs=this.getNullValueCVs(study);
    HashSet<Integer> itemDataIds=new HashSet<Integer>();
    String yearMonthFormat=StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("String_Node_Str"));
    String yearFormat=StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("String_Node_Str"));
    while (iter.hasNext()) {
      HashMap row=(HashMap)iter.next();
      Integer ecId=(Integer)row.get("String_Node_Str");
      Integer igId=(Integer)row.get("String_Node_Str");
      String igOID=(String)row.get("String_Node_Str");
      String igName=(String)row.get("String_Node_Str");
      Integer itId=(Integer)row.get("String_Node_Str");
      String itOID=(String)row.get("String_Node_Str");
      Integer itDataOrdinal=(Integer)row.get("String_Node_Str");
      String itValue=(String)row.get("String_Node_Str");
      Integer datatypeid=(Integer)row.get("String_Node_Str");
      Integer idataId=(Integer)row.get("String_Node_Str");
      String muOid=(String)row.get("String_Node_Str");
      String key="String_Node_Str";
      if (ecId != ecprev) {
        logger.error("String_Node_Str" + ecId + "String_Node_Str"+ oidPoses.containsKey(ecId));
        if (oidPoses.containsKey(ecId)) {
          goon=true;
          String[] poses=oidPoses.get(ecId).split("String_Node_Str");
          sub=data.getExportSubjectData().get(Integer.valueOf(poses[0]));
          se=sub.getExportStudyEventData().get(Integer.valueOf(poses[1]));
          form=se.getExportFormData().get(Integer.valueOf(poses[2]));
        }
 else {
          goon=false;
        }
        ecprev=ecId;
      }
      if (goon) {
        ImportItemGroupDataBean ig=new ImportItemGroupDataBean();
        key=ecId + "String_Node_Str" + igId;
        if (!igprev.equals(key) || !igpos.containsKey(key + itDataOrdinal)) {
          igpos.put(key + itDataOrdinal,form.getItemGroupData().size());
          igprev=key;
          ig.setItemGroupOID(igOID + "String_Node_Str");
          ig.setItemGroupRepeatKey("String_Node_Str".equalsIgnoreCase(igName) ? "String_Node_Str" : itDataOrdinal + "String_Node_Str");
          form.getItemGroupData().add(ig);
        }
 else {
          ig=form.getItemGroupData().get(igpos.get(key + itDataOrdinal));
        }
        String newpos=oidPoses.get(ecId) + "String_Node_Str" + igpos.get(key + itDataOrdinal);
        key=itId + "String_Node_Str" + itDataOrdinal+ key;
        if (!itprev.equals(key)) {
          itprev=key;
          ImportItemDataBean it=new ImportItemDataBean();
          it.setItemOID(itOID);
          it.setTransactionType("String_Node_Str");
          String nullKey=study.getId() + "String_Node_Str" + se.getStudyEventOID()+ "String_Node_Str"+ form.getFormOID();
          if (ClinicalDataUtil.isNull(itValue,nullKey,nullValueCVs)) {
            it.setIsNull("String_Node_Str");
            String nullvalues=ClinicalDataUtil.presetNullValueStr(nullValueCVs.get(nullKey));
            boolean hasValueWithNull=ClinicalDataUtil.isValueWithNull(itValue,nullvalues);
            it.setHasValueWithNull(hasValueWithNull);
            if (hasValueWithNull) {
              it.setValue(itValue);
              it.setReasonForNull(ClinicalDataUtil.getNullsInValue(itValue,nullvalues));
            }
 else {
              it.setReasonForNull(itValue.trim());
            }
          }
 else {
            if (datatypeid == 9) {
              try {
                itValue=new SimpleDateFormat("String_Node_Str").format(new SimpleDateFormat(oc_df_string).parse(itValue));
              }
 catch (              Exception fe) {
                logger.info("String_Node_Str" + itOID + "String_Node_Str"+ itValue+ "String_Node_Str");
              }
            }
            it.setValue(itValue);
          }
          if (muOid != null && muOid.length() > 0) {
            ElementRefBean measurementUnitRef=new ElementRefBean();
            measurementUnitRef.setElementDefOID(muOid);
            it.setMeasurementUnitRef(measurementUnitRef);
          }
          ig.getItemData().add(it);
          newpos+="String_Node_Str" + (ig.getItemData().size() - 1);
          idataOidPoses.put(idataId,newpos);
        }
        idataIds+="String_Node_Str" + idataId + "String_Node_Str";
      }
    }
  }
  idataIds=idataIds.length() > 0 ? idataIds.substring(0,idataIds.length() - 2) : idataIds;
  if (idataIds.length() > 0 && itemIds.length() > 0) {
    this.setErasedScoreItemDataValues(data,itemIds,idataIds,idataOidPoses,odmVersion);
  }
 else {
    logger.info("String_Node_Str");
  }
  if (odmType != null && odmType.equalsIgnoreCase("String_Node_Str")) {
    System.out.println("String_Node_Str");
  }
 else   if (odmVersion.startsWith("String_Node_Str")) {
    if (idataIds.length() > 0) {
      setOCItemDataAuditLogs(study,data,idataIds,idataOidPoses);
      setOCItemDataDNs(data,idataIds,idataOidPoses);
    }
 else {
      logger.info("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void getClinicalData(StudyBean study,DatasetBean dataset,OdmClinicalDataBean data,String odmVersion,String studySubjectIds,String odmType){
  String dbName=CoreResources.getDBName();
  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";
  HashMap<Integer,String> oidPoses=new HashMap<Integer,String>();
  HashMap<Integer,String> idataOidPoses=new HashMap<Integer,String>();
  String studyIds=study.getId() + "String_Node_Str";
  int datasetItemStatusId=dataset.getDatasetItemStatus().getId();
  String sql=dataset.getSQLStatement().split("String_Node_Str")[0].trim();
  sql=sql.split("String_Node_Str")[1];
  String[] ss=sql.split("String_Node_Str");
  String sedIds=ss[0];
  String[] sss=ss[1].split("String_Node_Str");
  String itemIds=sss[0];
  String dateConstraint="String_Node_Str";
  if ("String_Node_Str".equalsIgnoreCase(dbName)) {
    dateConstraint="String_Node_Str" + sss[1] + "String_Node_Str"+ sss[2];
    dateConstraint=dateConstraint.replace("String_Node_Str","String_Node_Str");
  }
 else   if ("String_Node_Str".equalsIgnoreCase(dbName)) {
    String[] os=(sss[1] + sss[2]).split("String_Node_Str");
    dateConstraint="String_Node_Str" + os[1] + "String_Node_Str"+ os[3]+ "String_Node_Str";
  }
  logger.debug("String_Node_Str");
  if (odmVersion.startsWith("String_Node_Str")) {
    logger.debug("String_Node_Str" + getOCSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    this.setSubjectEventFormDataTypesExpected(odmVersion);
    ArrayList viewRows=select(getOCSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    Iterator iter=viewRows.iterator();
    this.setDataWithOCAttributes(study,dataset,data,odmVersion,iter,oidPoses,odmType);
  }
 else {
    logger.debug("String_Node_Str" + getSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    this.setSubjectEventFormDataTypesExpected();
    ArrayList viewRows=select(getSubjectEventFormSqlSS(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
    Iterator iter=viewRows.iterator();
    while (iter.hasNext()) {
      HashMap row=(HashMap)iter.next();
      String studySubjectLabel=(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");
      String cvOID=(String)row.get("String_Node_Str");
      Integer ecId=(Integer)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);
      }
 else {
        subprev=studySubjectLabel;
        sub.setSubjectOID(studySubjectLabel);
        data.getExportSubjectData().add(sub);
        seprev="String_Node_Str";
        formprev="String_Node_Str";
        igprev="String_Node_Str";
      }
      oidPos=data.getExportSubjectData().size() - 1 + "String_Node_Str";
      ExportStudyEventDataBean se=new ExportStudyEventDataBean();
      key+=sedOID;
      if (!seprev.equals(key) || !sepos.containsKey(key + sampleOrdinal)) {
        sepos.put(key + sampleOrdinal,sub.getExportStudyEventData().size());
        seprev=key;
        se.setStudyEventOID(sedOID);
        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);
      ExportFormDataBean form=new ExportFormDataBean();
      key+=cvOID;
      if (formprev.equals(key)) {
        form=se.getExportFormData().get(se.getExportFormData().size() - 1);
      }
 else {
        formprev=key;
        form.setFormOID(cvOID);
        se.getExportFormData().add(form);
        igprev="String_Node_Str";
      }
      oidPos+="String_Node_Str" + (se.getExportFormData().size() - 1);
      oidPoses.put(ecId,oidPos);
      oidPos="String_Node_Str";
    }
  }
  this.setEventGroupItemDataWithUnitTypesExpected();
  logger.debug("String_Node_Str");
  ArrayList viewRows=select(getEventGroupItemWithUnitSql(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
  logger.debug("String_Node_Str" + getEventGroupItemWithUnitSql(studyIds,sedIds,itemIds,dateConstraint,datasetItemStatusId,studySubjectIds));
  String idataIds="String_Node_Str";
  if (viewRows.size() > 0) {
    Iterator iter=viewRows.iterator();
    ExportSubjectDataBean sub=new ExportSubjectDataBean();
    ExportStudyEventDataBean se=new ExportStudyEventDataBean();
    ExportFormDataBean form=new ExportFormDataBean();
    int ecprev=-1;
    igprev="String_Node_Str";
    boolean goon=true;
    String itprev="String_Node_Str";
    HashMap<String,String> nullValueCVs=this.getNullValueCVs(study);
    HashSet<Integer> itemDataIds=new HashSet<Integer>();
    String yearMonthFormat=StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("String_Node_Str"));
    String yearFormat=StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("String_Node_Str"));
    while (iter.hasNext()) {
      HashMap row=(HashMap)iter.next();
      Integer ecId=(Integer)row.get("String_Node_Str");
      Integer igId=(Integer)row.get("String_Node_Str");
      String igOID=(String)row.get("String_Node_Str");
      String igName=(String)row.get("String_Node_Str");
      Integer itId=(Integer)row.get("String_Node_Str");
      String itOID=(String)row.get("String_Node_Str");
      Integer itDataOrdinal=(Integer)row.get("String_Node_Str");
      String itValue=(String)row.get("String_Node_Str");
      Integer datatypeid=(Integer)row.get("String_Node_Str");
      Integer idataId=(Integer)row.get("String_Node_Str");
      String muOid=(String)row.get("String_Node_Str");
      String key="String_Node_Str";
      if (ecId != ecprev) {
        logger.debug("String_Node_Str" + ecId + "String_Node_Str"+ oidPoses.containsKey(ecId));
        if (oidPoses.containsKey(ecId)) {
          goon=true;
          String[] poses=oidPoses.get(ecId).split("String_Node_Str");
          sub=data.getExportSubjectData().get(Integer.valueOf(poses[0]));
          se=sub.getExportStudyEventData().get(Integer.valueOf(poses[1]));
          form=se.getExportFormData().get(Integer.valueOf(poses[2]));
        }
 else {
          goon=false;
        }
        ecprev=ecId;
      }
      if (goon) {
        ImportItemGroupDataBean ig=new ImportItemGroupDataBean();
        key=ecId + "String_Node_Str" + igId;
        if (!igprev.equals(key) || !igpos.containsKey(key + itDataOrdinal)) {
          igpos.put(key + itDataOrdinal,form.getItemGroupData().size());
          igprev=key;
          ig.setItemGroupOID(igOID + "String_Node_Str");
          ig.setItemGroupRepeatKey("String_Node_Str".equalsIgnoreCase(igName) ? "String_Node_Str" : itDataOrdinal + "String_Node_Str");
          form.getItemGroupData().add(ig);
        }
 else {
          ig=form.getItemGroupData().get(igpos.get(key + itDataOrdinal));
        }
        String newpos=oidPoses.get(ecId) + "String_Node_Str" + igpos.get(key + itDataOrdinal);
        key=itId + "String_Node_Str" + itDataOrdinal+ key;
        if (!itprev.equals(key)) {
          itprev=key;
          ImportItemDataBean it=new ImportItemDataBean();
          it.setItemOID(itOID);
          it.setTransactionType("String_Node_Str");
          String nullKey=study.getId() + "String_Node_Str" + se.getStudyEventOID()+ "String_Node_Str"+ form.getFormOID();
          if (ClinicalDataUtil.isNull(itValue,nullKey,nullValueCVs)) {
            it.setIsNull("String_Node_Str");
            String nullvalues=ClinicalDataUtil.presetNullValueStr(nullValueCVs.get(nullKey));
            boolean hasValueWithNull=ClinicalDataUtil.isValueWithNull(itValue,nullvalues);
            it.setHasValueWithNull(hasValueWithNull);
            if (hasValueWithNull) {
              it.setValue(itValue);
              it.setReasonForNull(ClinicalDataUtil.getNullsInValue(itValue,nullvalues));
            }
 else {
              it.setReasonForNull(itValue.trim());
            }
          }
 else {
            if (datatypeid == 9) {
              try {
                itValue=new SimpleDateFormat("String_Node_Str").format(new SimpleDateFormat(oc_df_string).parse(itValue));
              }
 catch (              Exception fe) {
                logger.debug("String_Node_Str" + itOID + "String_Node_Str"+ itValue+ "String_Node_Str");
              }
            }
            it.setValue(itValue);
          }
          if (muOid != null && muOid.length() > 0) {
            ElementRefBean measurementUnitRef=new ElementRefBean();
            measurementUnitRef.setElementDefOID(muOid);
            it.setMeasurementUnitRef(measurementUnitRef);
          }
          ig.getItemData().add(it);
          newpos+="String_Node_Str" + (ig.getItemData().size() - 1);
          idataOidPoses.put(idataId,newpos);
        }
        idataIds+="String_Node_Str" + idataId + "String_Node_Str";
      }
    }
  }
  idataIds=idataIds.length() > 0 ? idataIds.substring(0,idataIds.length() - 2) : idataIds;
  if (idataIds.length() > 0 && itemIds.length() > 0) {
    this.setErasedScoreItemDataValues(data,itemIds,idataIds,idataOidPoses,odmVersion);
  }
 else {
    logger.info("String_Node_Str");
  }
  if (odmType != null && odmType.equalsIgnoreCase("String_Node_Str")) {
    logger.debug("String_Node_Str");
  }
 else   if (odmVersion.startsWith("String_Node_Str")) {
    if (idataIds.length() > 0) {
      setOCItemDataAuditLogs(study,data,idataIds,idataOidPoses);
      setOCItemDataDNs(data,idataIds,idataOidPoses);
    }
 else {
      logger.info("String_Node_Str");
    }
  }
}