Program: 115010
Project: 115010
Buggy source:
private void setStudyConfigParameters(HttpServletRequest request,Study study,Study schemaStudy,StudyParameterConfig studyParameterConfig){
  String schema=CoreResources.getRequestSchema(request);
  CoreResources.setRequestSchema(request,study.getSchemaName());
  List<StudyParameterValue> studyParameterValues=new ArrayList<>();
  schemaStudy.setStudyParameterValues(studyParameterValues);
  StudyParameterValue collectDobValue=new StudyParameterValue();
  collectDobValue.setStudy(schemaStudy);
  StudyParameter collectDob=studyParameterDao.findByHandle("String_Node_Str");
  collectDobValue.setStudyParameter(collectDob);
  if (StringUtils.isEmpty(studyParameterConfig.getCollectDob())) {
    collectDobValue.setValue("String_Node_Str");
  }
 else {
switch (studyParameterConfig.getCollectDob().toLowerCase()) {
case "String_Node_Str":
      collectDobValue.setValue("String_Node_Str");
    break;
case "String_Node_Str":
  collectDobValue.setValue("String_Node_Str");
break;
default :
collectDobValue.setValue("String_Node_Str");
break;
}
}
studyParameterValues.add(collectDobValue);
StudyParameterValue discrepancyManagementValue=new StudyParameterValue();
discrepancyManagementValue.setStudy(schemaStudy);
StudyParameter discrepancyManagement=studyParameterDao.findByHandle("String_Node_Str");
discrepancyManagementValue.setStudyParameter(discrepancyManagement);
discrepancyManagementValue.setValue(studyParameterConfig.getDiscrepancyManagement());
studyParameterValues.add(discrepancyManagementValue);
StudyParameterValue genderRequiredValue=new StudyParameterValue();
genderRequiredValue.setStudy(schemaStudy);
StudyParameter genderRequired=studyParameterDao.findByHandle("String_Node_Str");
genderRequiredValue.setStudyParameter(genderRequired);
genderRequiredValue.setValue(studyParameterConfig.getGenderRequired());
studyParameterValues.add(genderRequiredValue);
StudyParameterValue subjectPersonIdRequiredValue=new StudyParameterValue();
subjectPersonIdRequiredValue.setStudy(schemaStudy);
StudyParameter subjectPersonIdRequired=studyParameterDao.findByHandle("String_Node_Str");
subjectPersonIdRequiredValue.setStudyParameter(subjectPersonIdRequired);
subjectPersonIdRequiredValue.setValue(studyParameterConfig.getSubjectPersonIdRequired());
studyParameterValues.add(subjectPersonIdRequiredValue);
StudyParameterValue interviewerNameRequiredValue=new StudyParameterValue();
interviewerNameRequiredValue.setStudy(schemaStudy);
StudyParameter interviewerNameRequired=studyParameterDao.findByHandle("String_Node_Str");
interviewerNameRequiredValue.setStudyParameter(interviewerNameRequired);
interviewerNameRequiredValue.setValue(studyParameterConfig.getInterviewerNameRequired());
studyParameterValues.add(interviewerNameRequiredValue);
StudyParameterValue interviewerNameEditableValue=new StudyParameterValue();
interviewerNameEditableValue.setStudy(schemaStudy);
StudyParameter interviewerNameEditable=studyParameterDao.findByHandle("String_Node_Str");
interviewerNameEditableValue.setStudyParameter(interviewerNameEditable);
interviewerNameEditableValue.setValue(studyParameterConfig.getInterviewerNameEditable());
studyParameterValues.add(interviewerNameEditableValue);
StudyParameterValue interviewDateRequiredValue=new StudyParameterValue();
interviewDateRequiredValue.setStudy(schemaStudy);
StudyParameter interviewDateRequired=studyParameterDao.findByHandle("String_Node_Str");
interviewDateRequiredValue.setStudyParameter(interviewDateRequired);
interviewDateRequiredValue.setValue(studyParameterConfig.getInterviewDateRequired());
studyParameterValues.add(interviewDateRequiredValue);
StudyParameterValue interviewDateDefaultValue=new StudyParameterValue();
interviewDateDefaultValue.setStudy(schemaStudy);
StudyParameter interviewDateDefault=studyParameterDao.findByHandle("String_Node_Str");
interviewDateDefaultValue.setStudyParameter(interviewDateDefault);
interviewDateDefaultValue.setValue(studyParameterConfig.getInterviewDateDefault());
studyParameterValues.add(interviewDateDefaultValue);
StudyParameterValue interviewDateEditableValue=new StudyParameterValue();
interviewDateEditableValue.setStudy(schemaStudy);
StudyParameter interviewDateEditable=studyParameterDao.findByHandle("String_Node_Str");
interviewDateEditableValue.setStudyParameter(interviewDateEditable);
interviewDateEditableValue.setValue(studyParameterConfig.getInterviewDateEditable());
studyParameterValues.add(interviewDateEditableValue);
StudyParameterValue subjectIdGenerationValue=new StudyParameterValue();
subjectIdGenerationValue.setStudy(schemaStudy);
StudyParameter subjectIdGeneration=studyParameterDao.findByHandle("String_Node_Str");
subjectIdGenerationValue.setStudyParameter(subjectIdGeneration);
subjectIdGenerationValue.setValue(studyParameterConfig.getSubjectIdGeneration());
studyParameterValues.add(subjectIdGenerationValue);
StudyParameterValue subjectIdPrefixSuffixValue=new StudyParameterValue();
subjectIdPrefixSuffixValue.setStudy(schemaStudy);
StudyParameter subjectIdPrefixSuffix=studyParameterDao.findByHandle("String_Node_Str");
subjectIdPrefixSuffixValue.setStudyParameter(subjectIdPrefixSuffix);
subjectIdPrefixSuffixValue.setValue(studyParameterConfig.getSubjectIdPrefixSuffix());
studyParameterValues.add(subjectIdPrefixSuffixValue);
StudyParameterValue personIdShownOnCRFValue=new StudyParameterValue();
personIdShownOnCRFValue.setStudy(schemaStudy);
StudyParameter personIdShownOnCRF=studyParameterDao.findByHandle("String_Node_Str");
personIdShownOnCRFValue.setStudyParameter(personIdShownOnCRF);
personIdShownOnCRFValue.setValue(studyParameterConfig.getPersonIdShownOnCRF());
studyParameterValues.add(personIdShownOnCRFValue);
studyDao.saveOrUpdate(schemaStudy);
if (StringUtils.isNotEmpty(schema)) CoreResources.setRequestSchema(request,schema);
}

Fixed version (ground truth):
private void setStudyConfigParameters(HttpServletRequest request,Study study,Study schemaStudy,StudyParameterConfig studyParameterConfig){
  String schema=CoreResources.getRequestSchema(request);
  CoreResources.setRequestSchema(request,study.getSchemaName());
  List<StudyParameterValue> studyParameterValues=new ArrayList<>();
  schemaStudy.setStudyParameterValues(studyParameterValues);
  StudyParameterValue collectDobValue=new StudyParameterValue();
  collectDobValue.setStudy(schemaStudy);
  StudyParameter collectDob=studyParameterDao.findByHandle("String_Node_Str");
  collectDobValue.setStudyParameter(collectDob);
  if (StringUtils.isEmpty(studyParameterConfig.getCollectDob())) {
    collectDobValue.setValue("String_Node_Str");
  }
 else {
switch (studyParameterConfig.getCollectDob().toLowerCase()) {
case "String_Node_Str":
      collectDobValue.setValue("String_Node_Str");
    break;
case "String_Node_Str":
  collectDobValue.setValue("String_Node_Str");
break;
default :
collectDobValue.setValue("String_Node_Str");
break;
}
}
studyParameterValues.add(collectDobValue);
StudyParameterValue discrepancyManagementValue=new StudyParameterValue();
discrepancyManagementValue.setStudy(schemaStudy);
StudyParameter discrepancyManagement=studyParameterDao.findByHandle("String_Node_Str");
discrepancyManagementValue.setStudyParameter(discrepancyManagement);
discrepancyManagementValue.setValue(studyParameterConfig.getDiscrepancyManagement());
studyParameterValues.add(discrepancyManagementValue);
StudyParameterValue genderRequiredValue=new StudyParameterValue();
genderRequiredValue.setStudy(schemaStudy);
StudyParameter genderRequired=studyParameterDao.findByHandle("String_Node_Str");
genderRequiredValue.setStudyParameter(genderRequired);
genderRequiredValue.setValue(studyParameterConfig.getGenderRequired());
studyParameterValues.add(genderRequiredValue);
StudyParameterValue subjectPersonIdRequiredValue=new StudyParameterValue();
subjectPersonIdRequiredValue.setStudy(schemaStudy);
StudyParameter subjectPersonIdRequired=studyParameterDao.findByHandle("String_Node_Str");
subjectPersonIdRequiredValue.setStudyParameter(subjectPersonIdRequired);
subjectPersonIdRequiredValue.setValue(handlePersonIdRequired(studyParameterConfig.getSubjectPersonIdRequired()));
studyParameterValues.add(subjectPersonIdRequiredValue);
StudyParameterValue interviewerNameRequiredValue=new StudyParameterValue();
interviewerNameRequiredValue.setStudy(schemaStudy);
StudyParameter interviewerNameRequired=studyParameterDao.findByHandle("String_Node_Str");
interviewerNameRequiredValue.setStudyParameter(interviewerNameRequired);
interviewerNameRequiredValue.setValue(studyParameterConfig.getInterviewerNameRequired());
studyParameterValues.add(interviewerNameRequiredValue);
StudyParameterValue interviewerNameEditableValue=new StudyParameterValue();
interviewerNameEditableValue.setStudy(schemaStudy);
StudyParameter interviewerNameEditable=studyParameterDao.findByHandle("String_Node_Str");
interviewerNameEditableValue.setStudyParameter(interviewerNameEditable);
interviewerNameEditableValue.setValue(studyParameterConfig.getInterviewerNameEditable());
studyParameterValues.add(interviewerNameEditableValue);
StudyParameterValue interviewDateRequiredValue=new StudyParameterValue();
interviewDateRequiredValue.setStudy(schemaStudy);
StudyParameter interviewDateRequired=studyParameterDao.findByHandle("String_Node_Str");
interviewDateRequiredValue.setStudyParameter(interviewDateRequired);
interviewDateRequiredValue.setValue(studyParameterConfig.getInterviewDateRequired());
studyParameterValues.add(interviewDateRequiredValue);
StudyParameterValue interviewDateDefaultValue=new StudyParameterValue();
interviewDateDefaultValue.setStudy(schemaStudy);
StudyParameter interviewDateDefault=studyParameterDao.findByHandle("String_Node_Str");
interviewDateDefaultValue.setStudyParameter(interviewDateDefault);
interviewDateDefaultValue.setValue(studyParameterConfig.getInterviewDateDefault());
studyParameterValues.add(interviewDateDefaultValue);
StudyParameterValue interviewDateEditableValue=new StudyParameterValue();
interviewDateEditableValue.setStudy(schemaStudy);
StudyParameter interviewDateEditable=studyParameterDao.findByHandle("String_Node_Str");
interviewDateEditableValue.setStudyParameter(interviewDateEditable);
interviewDateEditableValue.setValue(studyParameterConfig.getInterviewDateEditable());
studyParameterValues.add(interviewDateEditableValue);
StudyParameterValue subjectIdGenerationValue=new StudyParameterValue();
subjectIdGenerationValue.setStudy(schemaStudy);
StudyParameter subjectIdGeneration=studyParameterDao.findByHandle("String_Node_Str");
subjectIdGenerationValue.setStudyParameter(subjectIdGeneration);
subjectIdGenerationValue.setValue(studyParameterConfig.getSubjectIdGeneration());
studyParameterValues.add(subjectIdGenerationValue);
StudyParameterValue subjectIdPrefixSuffixValue=new StudyParameterValue();
subjectIdPrefixSuffixValue.setStudy(schemaStudy);
StudyParameter subjectIdPrefixSuffix=studyParameterDao.findByHandle("String_Node_Str");
subjectIdPrefixSuffixValue.setStudyParameter(subjectIdPrefixSuffix);
subjectIdPrefixSuffixValue.setValue(studyParameterConfig.getSubjectIdPrefixSuffix());
studyParameterValues.add(subjectIdPrefixSuffixValue);
StudyParameterValue personIdShownOnCRFValue=new StudyParameterValue();
personIdShownOnCRFValue.setStudy(schemaStudy);
StudyParameter personIdShownOnCRF=studyParameterDao.findByHandle("String_Node_Str");
personIdShownOnCRFValue.setStudyParameter(personIdShownOnCRF);
personIdShownOnCRFValue.setValue(studyParameterConfig.getPersonIdShownOnCRF());
studyParameterValues.add(personIdShownOnCRFValue);
studyDao.saveOrUpdate(schemaStudy);
if (StringUtils.isNotEmpty(schema)) CoreResources.setRequestSchema(request,schema);
}