nus-yam/ex-repair huggingface dataset:
Program: 115168
Project: 115168
Buggy source:
/** 
 * @param metadata The metadata to set.
 */
public void setMetadata(ItemFormMetadataBean metadata){
  this.metadata=metadata;
  ResponseSetBean rsb=metadata.getResponseSet();
  org.akaza.openclinica.bean.core.ResponseType rt=rsb.getResponseType();
  if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.CHECKBOX) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.RADIO) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.SELECT)|| rt.equals(org.akaza.openclinica.bean.core.ResponseType.SELECTMULTI)) {
    ArrayList nullValues=eventDefinitionCRF.getNullValuesList();
    for (int i=0; i < nullValues.size(); i++) {
      NullValue nv=(NullValue)nullValues.get(i);
      ResponseOptionBean ro=new ResponseOptionBean();
      ro.setValue(nv.getName());
      ro.setText(nv.getDescription());
      rsb.addOption(ro);
    }
  }
  metadata.setResponseSet(rsb);
}

Fixed version (ground truth):
/** 
 * @param metadata The metadata to set.
 */
public void setMetadata(ItemFormMetadataBean metadata){
  this.metadata=metadata;
  ResponseSetBean rsb=metadata.getResponseSet();
  org.akaza.openclinica.bean.core.ResponseType rt=rsb.getResponseType();
  if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.CHECKBOX) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.RADIO) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.SELECT)|| rt.equals(org.akaza.openclinica.bean.core.ResponseType.SELECTMULTI)) {
    if (eventDefinitionCRF != null) {
      ArrayList nullValues=eventDefinitionCRF.getNullValuesList();
      for (int i=0; i < nullValues.size(); i++) {
        NullValue nv=(NullValue)nullValues.get(i);
        ResponseOptionBean ro=new ResponseOptionBean();
        ro.setValue(nv.getName());
        ro.setText(nv.getDescription());
        rsb.addOption(ro);
      }
    }
  }
  metadata.setResponseSet(rsb);
}
Program: 115170
Project: 115170
Buggy source:
public HashMap validateForm(FormProcessor fp,HttpServletRequest request,String[] triggerNames,String properName){
  Validator v=new Validator(request);
  v.addValidation(JOB_NAME,Validator.NO_BLANKS);
  v.addValidation(JOB_DESC,Validator.NO_BLANKS);
  v.addValidation(EMAIL,Validator.IS_A_EMAIL);
  v.addValidation(PERIOD,Validator.NO_BLANKS);
  v.addValidation(DATE_START_JOB + "String_Node_Str",Validator.IS_A_DATE);
  int formatId=fp.getInt(FORMAT_ID);
  Date jobDate=fp.getDateTime(DATE_START_JOB);
  HashMap errors=v.validate();
  if (formatId == 0) {
    v.addError(errors,FORMAT_ID,"String_Node_Str");
  }
  for (  String triggerName : triggerNames) {
    if (triggerName.equals(fp.getString(JOB_NAME)) && (!triggerName.equals(properName))) {
      v.addError(errors,JOB_NAME,"String_Node_Str");
    }
  }
  if (jobDate.before(new Date())) {
    v.addError(errors,DATE_START_JOB + "String_Node_Str","String_Node_Str");
  }
  return errors;
}

Fixed version (ground truth):
public HashMap validateForm(FormProcessor fp,HttpServletRequest request,String[] triggerNames,String properName){
  Validator v=new Validator(request);
  v.addValidation(JOB_NAME,Validator.NO_BLANKS);
  v.addValidation(JOB_DESC,Validator.NO_BLANKS);
  v.addValidation(EMAIL,Validator.IS_A_EMAIL);
  v.addValidation(PERIOD,Validator.NO_BLANKS);
  v.addValidation(DATE_START_JOB + "String_Node_Str",Validator.IS_A_DATE);
  int formatId=fp.getInt(FORMAT_ID);
  Date jobDate=fp.getDateTime(DATE_START_JOB);
  HashMap errors=v.validate();
  if (formatId == 0) {
    v.addError(errors,FORMAT_ID,"String_Node_Str");
  }
  for (  String triggerName : triggerNames) {
    if (triggerName.equals(fp.getString(JOB_NAME)) && (!triggerName.equals(properName))) {
      v.addError(errors,JOB_NAME,"String_Node_Str");
    }
  }
  if (jobDate.before(new Date())) {
    v.addError(errors,DATE_START_JOB + "String_Node_Str","String_Node_Str");
  }
  String jobDesc=fp.getString(JOB_DESC);
  if ((null != jobDesc) && (!jobDesc.equals("String_Node_Str"))) {
    if (jobDesc.length() > 250) {
      v.addError(errors,JOB_DESC,"String_Node_Str");
    }
  }
  return errors;
}
Program: 115173
Project: 115173
Buggy source:
public static String getAttachedFilePath(StudyBean study){
  String attachedFilePath=CoreResources.getField("String_Node_Str");
  if (attachedFilePath == null || attachedFilePath.length() <= 0) {
    attachedFilePath=CoreResources.getField("String_Node_Str") + "String_Node_Str" + File.separator+ study.getIdentifier()+ File.separator;
  }
 else {
    attachedFilePath+=study.getIdentifier() + File.separator;
  }
  return attachedFilePath;
}

Fixed version (ground truth):
public static String getAttachedFilePath(StudyBean study){
  String attachedFilePath=CoreResources.getField("String_Node_Str");
  if (attachedFilePath == null || attachedFilePath.length() <= 0) {
    attachedFilePath=CoreResources.getField("String_Node_Str") + "String_Node_Str" + File.separator+ study.getOid()+ File.separator;
  }
 else {
    attachedFilePath+=study.getOid() + File.separator;
  }
  return attachedFilePath;
}
Program: 115174
Project: 115174
Buggy source:
public void setResourceLoader(ResourceLoader resourceLoader){
  this.resourceLoader=resourceLoader;
  try {
    webapp=getWebAppName(resourceLoader.getResource("String_Node_Str").getURI().getPath());
    logMe("String_Node_Str" + webapp);
    String dbName=dataInfo.getProperty("String_Node_Str");
    DATAINFO=dataInfo;
    dataInfo=setDataInfoProperties();
    EXTRACTINFO=extractInfo;
    DB_NAME=dbName;
    SQLFactory factory=SQLFactory.getInstance();
    factory.run(dbName,resourceLoader);
    copyBaseToDest(resourceLoader);
    extractProperties=findExtractProperties();
  }
 catch (  OpenClinicaSystemException e) {
    logger.debug(e.getMessage());
    logger.debug(e.toString());
    throw new OpenClinicaSystemException(e.getMessage(),e.fillInStackTrace());
  }
catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void setResourceLoader(ResourceLoader resourceLoader){
  this.resourceLoader=resourceLoader;
  try {
    setODM_MAPPING_DIR();
    webapp=getWebAppName(resourceLoader.getResource("String_Node_Str").getURI().getPath());
    logMe("String_Node_Str" + webapp);
    String dbName=dataInfo.getProperty("String_Node_Str");
    DATAINFO=dataInfo;
    dataInfo=setDataInfoProperties();
    EXTRACTINFO=extractInfo;
    DB_NAME=dbName;
    SQLFactory factory=SQLFactory.getInstance();
    factory.run(dbName,resourceLoader);
    copyBaseToDest(resourceLoader);
    copyODMMappingXMLtoResources(resourceLoader);
    extractProperties=findExtractProperties();
  }
 catch (  OpenClinicaSystemException e) {
    logger.debug(e.getMessage());
    logger.debug(e.toString());
    throw new OpenClinicaSystemException(e.getMessage(),e.fillInStackTrace());
  }
catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 115176
Project: 115176
Buggy source:
/** 
 * Register the user in the MDC under USER_KEY.
 * @param username
 * @return true id the user can be successfully registered
 */
private boolean registerUsernameWithLogContext(String username){
  if (username != null && username.trim().length() > 0) {
    MDC.put(LoggingConstants.USERNAME,username);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Register the user in the MDC under USERNAME.
 * @param username
 * @return true id the user can be successfully registered
 */
private boolean registerUsernameWithLogContext(String username){
  if (username != null && username.trim().length() > 0) {
    MDC.put(LoggingConstants.USERNAME,username);
    return true;
  }
  return false;
}
Program: 115182
Project: 115182
Buggy source:
/** 
 * Changed by thickerson 05/2010
 * @param idb
 * @param formName
 * @param error
 * @param request TODO
 */
protected void setReasonForChangeError(ItemDataBean idb,String formName,String error,HttpServletRequest request){
  DiscrepancyNoteDAO dndao=new DiscrepancyNoteDAO(getDataSource());
  HttpSession session=request.getSession();
  FormDiscrepancyNotes fdn=(FormDiscrepancyNotes)session.getAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME);
  HashMap idNotes=fdn.getIdNotes();
  int existingNotes=dndao.findNumExistingNotesForItem(idb.getId());
  if (existingNotes > 0) {
    logger.debug("String_Node_Str" + formName);
    HashMap<Integer,Boolean> noteSubmitted=(HashMap<Integer,Boolean>)session.getAttribute(DataEntryServlet.NOTE_SUBMITTED);
    if (noteSubmitted == null || noteSubmitted.get(idb.getId()) == null || !(Boolean)noteSubmitted.get(idb.getId())) {
      boolean hasRfcAlready=false;
      ArrayList<DiscrepancyNoteBean> notes=dndao.findExistingNotesForItemData(idb.getId());
      for (      DiscrepancyNoteBean note : notes) {
        if (note.getDiscrepancyNoteTypeId() == DiscrepancyNoteType.REASON_FOR_CHANGE.getId()) {
          hasRfcAlready=true;
          logger.debug("String_Node_Str" + formName + "String_Node_Str"+ note.getId());
        }
      }
      if (!hasRfcAlready) {
        errors.put(formName,error);
      }
    }
 else {
      logger.debug("String_Node_Str");
      logger.debug("String_Node_Str" + formName + "String_Node_Str"+ errors.toString());
    }
  }
 else   if (idNotes.containsKey(idb.getId())) {
    logger.debug("String_Node_Str");
  }
 else {
    logger.debug("String_Node_Str" + formName);
    errors.put(formName,error);
  }
}

Fixed version (ground truth):
/** 
 * Changed by thickerson 05/2010
 * @param idb
 * @param formName
 * @param error
 * @param request TODO
 */
protected void setReasonForChangeError(ItemDataBean idb,String formName,String error,HttpServletRequest request){
  DiscrepancyNoteDAO dndao=new DiscrepancyNoteDAO(getDataSource());
  HttpSession session=request.getSession();
  FormDiscrepancyNotes fdn=(FormDiscrepancyNotes)session.getAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME);
  HashMap idNotes=fdn.getIdNotes();
  int existingNotes=dndao.findNumExistingNotesForItem(idb.getId());
  if (existingNotes > 0) {
    logger.debug("String_Node_Str" + formName);
    HashMap<Integer,Boolean> noteSubmitted=(HashMap<Integer,Boolean>)session.getAttribute(DataEntryServlet.NOTE_SUBMITTED);
    if (noteSubmitted == null || noteSubmitted.get(idb.getId()) == null || !(Boolean)noteSubmitted.get(idb.getId())) {
      errors.put(formName,error);
    }
 else {
      logger.debug("String_Node_Str");
      logger.debug("String_Node_Str" + formName + "String_Node_Str"+ errors.toString());
    }
  }
 else   if (idNotes.containsKey(idb.getId())) {
    logger.debug("String_Node_Str");
  }
 else {
    logger.debug("String_Node_Str" + formName);
    errors.put(formName,error);
  }
}
Program: 115183
Project: 115183
Buggy source:
public static void main(String[] args){
  ResourceBundleProvider.updateLocale(new Locale("String_Node_Str"));
  ResolutionStatus test=new ResolutionStatus(1,"String_Node_Str",null);
  System.out.println("String_Node_Str" + test.getId());
  System.out.println(test.getName());
  logger.info("String_Node_Str" + test.getId());
  logger.info(test.getName());
}

Fixed version (ground truth):
public static void main(String[] args){
  ResourceBundleProvider.updateLocale(new Locale("String_Node_Str"));
  ResolutionStatus test=new ResolutionStatus(1,"String_Node_Str",null,null);
  System.out.println("String_Node_Str" + test.getId());
  System.out.println(test.getName());
  logger.info("String_Node_Str" + test.getId());
  logger.info(test.getName());
}
Program: 115184
Project: 115184
Buggy source:
/** 
 * @param resolutionStatusId The resolutionStatusId to set.
 */
public void setResolutionStatusId(int resolutionStatusId){
  this.resolutionStatusId=resolutionStatusId;
}

Fixed version (ground truth):
/** 
 * @param resolutionStatusId The resolutionStatusId to set.
 */
public void setResolutionStatusId(int resolutionStatusId){
  this.resolutionStatusId=resolutionStatusId;
  if (resolutionStatusId != 0) {
    this.resStatus=ResolutionStatus.get(resolutionStatusId);
  }
}
Program: 115191
Project: 115191
Buggy source:
/** 
 * @return Returns the runTime.
 */
public long getRunTime(){
  return runTime;
}

Fixed version (ground truth):
/** 
 * @return Returns the runTime.
 */
public double getRunTime(){
  return runTime;
}
Program: 115192
Project: 115192
Buggy source:
/** 
 * @param runTime The runTime to set.
 */
public void setRunTime(long runTime){
  this.runTime=runTime;
}

Fixed version (ground truth):
/** 
 * @param runTime The runTime to set.
 */
public void setRunTime(double runTime){
  this.runTime=runTime;
}
Program: 115193
Project: 115193
Buggy source:
public Object getEntityFromHashMap(HashMap hm){
  ArchivedDatasetFileBean fb=new ArchivedDatasetFileBean();
  fb.setId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setDateCreated((Date)hm.get("String_Node_Str"));
  fb.setName((String)hm.get("String_Node_Str"));
  fb.setId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setDatasetId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setExportFormatId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setFileReference((String)hm.get("String_Node_Str"));
  fb.setRunTime(((Integer)hm.get("String_Node_Str")).longValue());
  fb.setFileSize(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setOwnerId(((Integer)hm.get("String_Node_Str")).intValue());
  UserAccountDAO uaDAO=new UserAccountDAO(this.ds);
  UserAccountBean owner=(UserAccountBean)uaDAO.findByPK(fb.getOwnerId());
  fb.setOwner(owner);
  return fb;
}

Fixed version (ground truth):
public Object getEntityFromHashMap(HashMap hm){
  ArchivedDatasetFileBean fb=new ArchivedDatasetFileBean();
  fb.setId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setDateCreated((Date)hm.get("String_Node_Str"));
  fb.setName((String)hm.get("String_Node_Str"));
  fb.setId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setDatasetId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setExportFormatId(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setFileReference((String)hm.get("String_Node_Str"));
  fb.setRunTime(((Integer)hm.get("String_Node_Str")).doubleValue());
  fb.setFileSize(((Integer)hm.get("String_Node_Str")).intValue());
  fb.setOwnerId(((Integer)hm.get("String_Node_Str")).intValue());
  UserAccountDAO uaDAO=new UserAccountDAO(this.ds);
  UserAccountBean owner=(UserAccountBean)uaDAO.findByPK(fb.getOwnerId());
  fb.setOwner(owner);
  return fb;
}
Program: 115195
Project: 115195
Buggy source:
private void sendRestoreEmail(UserAccountBean u,String password) throws Exception {
  logger.info("String_Node_Str" + u.getName());
  String body=resword.getString("String_Node_Str") + "String_Node_Str" + u.getFirstName()+ "String_Node_Str"+ u.getLastName()+ "String_Node_Str";
  body+=restext.getString("String_Node_Str") + "String_Node_Str";
  body+=resword.getString("String_Node_Str") + "String_Node_Str" + u.getName()+ "String_Node_Str";
  body+=resword.getString("String_Node_Str") + "String_Node_Str" + password+ "String_Node_Str";
  body+=restext.getString("String_Node_Str") + "String_Node_Str";
  body+=restext.getString("String_Node_Str");
  logger.info("String_Node_Str");
  sendEmail(u.getEmail().trim(),restext.getString("String_Node_Str"),body,false);
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
private void sendRestoreEmail(UserAccountBean u,String password) throws Exception {
  logger.info("String_Node_Str" + u.getName());
  String body=resword.getString("String_Node_Str") + "String_Node_Str" + u.getFirstName()+ "String_Node_Str"+ u.getLastName()+ "String_Node_Str";
  body+=restext.getString("String_Node_Str") + "String_Node_Str";
  body+=resword.getString("String_Node_Str") + "String_Node_Str" + u.getName()+ "String_Node_Str";
  body+=resword.getString("String_Node_Str") + "String_Node_Str" + password+ "String_Node_Str";
  body+=restext.getString("String_Node_Str") + "String_Node_Str";
  body+=SQLInitServlet.getField("String_Node_Str");
  body+="String_Node_Str";
  body+=restext.getString("String_Node_Str");
  logger.info("String_Node_Str");
  sendEmail(u.getEmail().trim(),restext.getString("String_Node_Str"),body,false);
  logger.info("String_Node_Str");
}
Program: 115197
Project: 115197
Buggy source:
public StudyBean generateStudyBean(UserAccountBean user,Node study) throws Exception {
  StudyBean studyBean=new StudyBean();
  studyBean.setOwner(user);
  DomParsingService xmlService=new DomParsingService();
  studyBean.setStatus(Status.AVAILABLE);
  studyBean.setName(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setPhase(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSummary(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSecondaryIdentifier(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  int enrollment=xmlService.getTargetAccrualNumberRange(study);
  studyBean.setExpectedTotalEnrollment(enrollment);
  studyBean=xmlService.getStudyInvestigator(studyBean,study);
  studyBean=xmlService.getStudyCenter(studyBean,study);
  studyBean=xmlService.getSponsorName(studyBean,study);
  studyBean=xmlService.getStudyIdentifier(studyBean,study);
  return studyBean;
}

Fixed version (ground truth):
public StudyBean generateStudyBean(UserAccountBean user,Node study) throws Exception {
  StudyBean studyBean=new StudyBean();
  studyBean.setOwner(user);
  DomParsingService xmlService=new DomParsingService();
  studyBean.setStatus(Status.AVAILABLE);
  studyBean.setName(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setOfficialTitle(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setProtocolDescription(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setPhase(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setPurpose(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSummary(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  if (studyBean.getSummary().length() <= 2) {
    studyBean.setSummary("String_Node_Str");
  }
  studyBean.setSecondaryIdentifier(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  int enrollment=xmlService.getTargetAccrualNumberRange(study);
  studyBean.setExpectedTotalEnrollment(enrollment);
  studyBean=xmlService.getStudyInvestigator(studyBean,study);
  studyBean=xmlService.getStudyCenter(studyBean,study);
  studyBean=xmlService.getSponsorName(studyBean,study);
  studyBean=xmlService.getStudyIdentifier(studyBean,study);
  return studyBean;
}
Program: 115199
Project: 115199
Buggy source:
/** 
 * <ns2:studyProtocolIdentification> <ns2:assignedDate xmlns:ns1="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:TS" nullFlavor="NI"/> <ns2:identifier xmlns:ns1="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:II" root="2.16.840.1.113883.3.26.7.7" extension="AU-67001" identifierName="Study Protocol" displayable="false"/>
 * @param study
 * @param studyNode
 * @return
 */
public StudyBean getStudyIdentifier(StudyBean study,Node studyNode) throws Exception {
  Element studyElement=(Element)studyNode;
  NodeList nlist=studyElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Node nlistNode=nlist.item(0);
  String identifier=this.getElementValue(nlistNode,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str");
  study.setIdentifier(identifier);
  return study;
}

Fixed version (ground truth):
/** 
 * <ns2:studyProtocolIdentification> <ns2:assignedDate xmlns:ns1="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:TS" nullFlavor="NI"/> <ns2:identifier xmlns:ns1="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:II" root="2.16.840.1.113883.3.26.7.7" extension="AU-67001" identifierName="Study Protocol" displayable="false"/> Keep in mind that there are multiple elements here, so we should only grab the identifier where primaryIndicator = true.
 * @param study
 * @param studyNode
 * @return
 */
public StudyBean getStudyIdentifier(StudyBean study,Node studyNode) throws Exception {
  Element studyElement=(Element)studyNode;
  NodeList nlist=studyElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  String identifier="String_Node_Str";
  System.out.println("String_Node_Str" + nlist.getLength() + "String_Node_Str");
  for (int j=0; j < nlist.getLength(); j++) {
    Node nlistNode=nlist.item(j);
    String isPrimaryIdentifier=this.getElementValue(nlistNode,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str");
    if ("String_Node_Str".equals(isPrimaryIdentifier)) {
      identifier=this.getElementValue(nlistNode,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str");
    }
  }
  study.setIdentifier(identifier);
  study.setSecondaryIdentifier(identifier);
  return study;
}
Program: 115209
Project: 115209
Buggy source:
private String getCrfVersionStatus(String seSubjectEventStatus,int cvStatusId,int ecStatusId,int validatorId){
  DataEntryStage stage=DataEntryStage.INVALID;
  Status status=Status.get(ecStatusId);
  if (stage.equals(DataEntryStage.INVALID) || status.equals(Status.INVALID)) {
    stage=DataEntryStage.UNCOMPLETED;
  }
  if (status.equals(Status.AVAILABLE)) {
    stage=DataEntryStage.INITIAL_DATA_ENTRY;
  }
  if (status.equals(Status.PENDING)) {
    if (validatorId != 0) {
      stage=DataEntryStage.DOUBLE_DATA_ENTRY;
    }
 else {
      stage=DataEntryStage.INITIAL_DATA_ENTRY_COMPLETE;
    }
  }
  if (status.equals(Status.UNAVAILABLE)) {
    stage=DataEntryStage.DOUBLE_DATA_ENTRY_COMPLETE;
  }
  if (status.equals(Status.LOCKED)) {
    stage=DataEntryStage.LOCKED;
  }
  try {
    if (seSubjectEventStatus.equals(SubjectEventStatus.LOCKED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.SKIPPED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.STOPPED.getName())) {
      stage=DataEntryStage.LOCKED;
    }
 else     if (seSubjectEventStatus.equals(SubjectEventStatus.INVALID.getName())) {
      stage=DataEntryStage.LOCKED;
    }
 else     if (cvStatusId != 1) {
      stage=DataEntryStage.LOCKED;
    }
  }
 catch (  NullPointerException e) {
    System.out.println("String_Node_Str");
  }
  logger.info("String_Node_Str" + stage.getName());
  return stage.getName();
}

Fixed version (ground truth):
private String getCrfVersionStatus(String seSubjectEventStatus,int cvStatusId,int ecStatusId,int validatorId){
  DataEntryStage stage=DataEntryStage.INVALID;
  Status status=Status.get(ecStatusId);
  if (stage.equals(DataEntryStage.INVALID) || status.equals(Status.INVALID)) {
    stage=DataEntryStage.UNCOMPLETED;
  }
  if (status.equals(Status.AVAILABLE)) {
    stage=DataEntryStage.INITIAL_DATA_ENTRY;
  }
  if (status.equals(Status.PENDING)) {
    if (validatorId != 0) {
      stage=DataEntryStage.DOUBLE_DATA_ENTRY;
    }
 else {
      stage=DataEntryStage.INITIAL_DATA_ENTRY_COMPLETE;
    }
  }
  if (status.equals(Status.UNAVAILABLE)) {
    stage=DataEntryStage.DOUBLE_DATA_ENTRY_COMPLETE;
  }
  if (status.equals(Status.LOCKED)) {
    stage=DataEntryStage.LOCKED;
  }
  try {
    if (seSubjectEventStatus.equals(SubjectEventStatus.LOCKED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.SKIPPED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.STOPPED.getName())) {
      stage=DataEntryStage.LOCKED;
    }
 else     if (seSubjectEventStatus.equals(SubjectEventStatus.INVALID.getName())) {
      stage=DataEntryStage.LOCKED;
    }
 else     if (cvStatusId != 1) {
      stage=DataEntryStage.LOCKED;
    }
  }
 catch (  NullPointerException e) {
    System.out.println("String_Node_Str");
  }
  logger.debug("String_Node_Str" + stage.getName());
  return stage.getName();
}
Program: 115223
Project: 115223
Buggy source:
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  int ordinal=getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean);
  StudyEventBean testStudyEventBean=(StudyEventBean)getStudyEventDao().findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubjectBean.getId(),sedBean.getId(),ordinal);
  if (testStudyEventBean != null && testStudyEventBean.getId() > 0) {
    return testStudyEventBean;
  }
 else {
    StudyEventBean newStudyEventBean=new StudyEventBean();
    newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
    newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
    newStudyEventBean.setStudyEventDefinition(sedBean);
    newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
    newStudyEventBean.setSampleOrdinal(ordinal);
    newStudyEventBean.setStartTimeFlag(true);
    newStudyEventBean.setEndTimeFlag(false);
    newStudyEventBean.setOwner(getUserAccount());
    newStudyEventBean.setStatus(Status.AVAILABLE);
    newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
    newStudyEventBean.setStudySubject(studySubjectBean);
    newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
    newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
    return newStudyEventBean;
  }
}

Fixed version (ground truth):
/** 
 * generates our study event bean TODO try EventService instead?
 * @param sedBean
 * @param studySubjectBean
 * @return
 */
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  int ordinal=getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean);
  StudyEventBean testStudyEventBean=(StudyEventBean)getStudyEventDao().findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubjectBean.getId(),sedBean.getId(),ordinal);
  if (testStudyEventBean != null && testStudyEventBean.getId() > 0) {
    return testStudyEventBean;
  }
 else {
    StudyEventBean newStudyEventBean=new StudyEventBean();
    newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
    newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
    newStudyEventBean.setStudyEventDefinition(sedBean);
    newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
    newStudyEventBean.setSampleOrdinal(ordinal + 1);
    newStudyEventBean.setStartTimeFlag(true);
    newStudyEventBean.setEndTimeFlag(false);
    newStudyEventBean.setOwner(getUserAccount());
    newStudyEventBean.setStatus(Status.AVAILABLE);
    newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
    newStudyEventBean.setStudySubject(studySubjectBean);
    newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
    newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
    return newStudyEventBean;
  }
}
Program: 115224
Project: 115224
Buggy source:
/** 
 * generates our study event bean TODO try EventService instead?
 * @param sedBean
 * @param studySubjectBean
 * @return
 */
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  int ordinal=getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean);
  StudyEventBean testStudyEventBean=(StudyEventBean)getStudyEventDao().findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubjectBean.getId(),sedBean.getId(),ordinal);
  if (testStudyEventBean != null && testStudyEventBean.getId() > 0) {
    return testStudyEventBean;
  }
 else {
    StudyEventBean newStudyEventBean=new StudyEventBean();
    newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
    newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
    newStudyEventBean.setStudyEventDefinition(sedBean);
    newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
    newStudyEventBean.setSampleOrdinal(ordinal + 1);
    newStudyEventBean.setStartTimeFlag(true);
    newStudyEventBean.setEndTimeFlag(false);
    newStudyEventBean.setOwner(getUserAccount());
    newStudyEventBean.setStatus(Status.AVAILABLE);
    newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
    newStudyEventBean.setStudySubject(studySubjectBean);
    newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
    newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
    return newStudyEventBean;
  }
}

Fixed version (ground truth):
/** 
 * generates our study event bean TODO try EventService instead?
 * @param sedBean
 * @param studySubjectBean
 * @return
 */
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  int ordinal=getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean);
  StudyEventBean newStudyEventBean=new StudyEventBean();
  newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
  newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
  newStudyEventBean.setStudyEventDefinition(sedBean);
  newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
  newStudyEventBean.setSampleOrdinal(ordinal + 1);
  newStudyEventBean.setStartTimeFlag(true);
  newStudyEventBean.setEndTimeFlag(false);
  newStudyEventBean.setOwner(getUserAccount());
  newStudyEventBean.setStatus(Status.AVAILABLE);
  newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
  newStudyEventBean.setStudySubject(studySubjectBean);
  newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
  newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
  return newStudyEventBean;
}
Program: 115228
Project: 115228
Buggy source:
public Element mapLoadLabsErrorConfirmation(String message,OpenClinicaException exception) throws Exception {
  DocumentBuilderFactory dbfac=DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder=dbfac.newDocumentBuilder();
  Document document=docBuilder.newDocument();
  Element responseElement=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element indicator=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Attr typeAttr=document.createAttributeNS(XSL_NAMESPACE,"String_Node_Str");
  typeAttr.setNodeValue("String_Node_Str");
  indicator.setAttributeNode(typeAttr);
  indicator.setAttribute("String_Node_Str","String_Node_Str");
  responseElement.appendChild(indicator);
  Element errormessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element code=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  code.setTextContent(exception.errorID);
  errormessage.appendChild(code);
  Element reason=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  reason.setTextContent(exception.message);
  errormessage.appendChild(reason);
  responseElement.appendChild(errormessage);
  return responseElement;
}

Fixed version (ground truth):
public Element mapLoadLabsErrorConfirmation(String message,OpenClinicaException exception) throws Exception {
  return mapGenericErrorConfirmation(message,exception,new HashMap<String,String>());
}
Program: 115229
Project: 115229
Buggy source:
public Element mapSubjectErrorConfirmation(String message) throws Exception {
  DocumentBuilderFactory dbfac=DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder=dbfac.newDocumentBuilder();
  Document document=docBuilder.newDocument();
  Element responseElement=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element indicator=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Attr typeAttr=document.createAttributeNS(XSL_NAMESPACE,"String_Node_Str");
  typeAttr.setNodeValue("String_Node_Str");
  indicator.setAttributeNode(typeAttr);
  indicator.setAttribute("String_Node_Str","String_Node_Str");
  responseElement.appendChild(indicator);
  Element errormessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element code=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  code.setTextContent("String_Node_Str");
  errormessage.appendChild(code);
  Element reason=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  reason.setTextContent(message);
  errormessage.appendChild(reason);
  responseElement.appendChild(errormessage);
  return responseElement;
}

Fixed version (ground truth):
public Element mapSubjectErrorConfirmation(String message) throws Exception {
  return mapGenericErrorConfirmation(message,new CCSystemFaultException("String_Node_Str"),new HashMap<String,String>());
}
Program: 115230
Project: 115230
Buggy source:
public Element mapStudyErrorConfirmation(String message,OpenClinicaException exception) throws Exception {
  DocumentBuilderFactory dbfac=DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder=dbfac.newDocumentBuilder();
  Document document=docBuilder.newDocument();
  Element responseElement=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element indicator=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Attr typeAttr=document.createAttributeNS(XSL_NAMESPACE,"String_Node_Str");
  typeAttr.setNodeValue("String_Node_Str");
  indicator.setAttributeNode(typeAttr);
  indicator.setAttribute("String_Node_Str","String_Node_Str");
  responseElement.appendChild(indicator);
  Element errormessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Element code=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  code.setTextContent(exception.errorID);
  errormessage.appendChild(code);
  Element reason=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  reason.setTextContent(exception.message);
  errormessage.appendChild(reason);
  responseElement.appendChild(errormessage);
  return responseElement;
}

Fixed version (ground truth):
public Element mapStudyErrorConfirmation(String message,OpenClinicaException exception) throws Exception {
  return mapGenericErrorConfirmation(message,exception,new HashMap<String,String>());
}
Program: 115231
Project: 115231
Buggy source:
public CCBusinessFaultException(String message,String idcode){
  super(message,idcode);
}

Fixed version (ground truth):
public CCBusinessFaultException(String message,String idcode){
  super(message,idcode);
  this.className="String_Node_Str";
}
Program: 115232
Project: 115232
Buggy source:
public CCDataValidationFaultException(String message,String idcode){
  super(message,idcode);
}

Fixed version (ground truth):
public CCDataValidationFaultException(String message,String idcode){
  super(message,idcode);
  this.className="String_Node_Str";
}
Program: 115233
Project: 115233
Buggy source:
public CCSystemFaultException(String message,String idcode){
  super(message,idcode);
}

Fixed version (ground truth):
public CCSystemFaultException(String message,String idcode){
  super(message,idcode);
  this.className="String_Node_Str";
}
Program: 115234
Project: 115234
Buggy source:
public StudyBean generateStudyBean(UserAccountBean user,Node study) throws Exception {
  StudyBean studyBean=new StudyBean();
  studyBean.setOwner(user);
  DomParsingService xmlService=new DomParsingService();
  studyBean.setIdentifier(xmlService.getElementValue(study,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setStatus(Status.AVAILABLE);
  studyBean.setName(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setPhase(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSummary(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSecondaryIdentifier(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  int enrollment=xmlService.getTargetAccrualNumberRange(study);
  studyBean.setExpectedTotalEnrollment(enrollment);
  System.out.println("String_Node_Str" + enrollment);
  studyBean=xmlService.getStudyInvestigator(studyBean,study);
  studyBean=xmlService.getStudyCenter(studyBean,study);
  studyBean=xmlService.getSponsorName(studyBean,study);
  return studyBean;
}

Fixed version (ground truth):
public StudyBean generateStudyBean(UserAccountBean user,Node study) throws Exception {
  StudyBean studyBean=new StudyBean();
  studyBean.setOwner(user);
  DomParsingService xmlService=new DomParsingService();
  studyBean.setIdentifier(xmlService.getElementValue(study,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setStatus(Status.AVAILABLE);
  studyBean.setName(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setPhase(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSummary(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  studyBean.setSecondaryIdentifier(xmlService.getElementValue(study,this.CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str"));
  int enrollment=xmlService.getTargetAccrualNumberRange(study);
  studyBean.setExpectedTotalEnrollment(enrollment);
  studyBean=xmlService.getStudyInvestigator(studyBean,study);
  studyBean=xmlService.getStudyCenter(studyBean,study);
  studyBean=xmlService.getSponsorName(studyBean,study);
  return studyBean;
}
Program: 115236
Project: 115236
Buggy source:
public StudyBean getSponsorName(StudyBean study,Node studyNode) throws CCDataValidationFaultException {
  String sponsorName="String_Node_Str";
  Element studyElement=(Element)studyNode;
  NodeList nlist=studyElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Node nlistNode=nlist.item(0);
  Element nlistNodeElement=(Element)nlistNode;
  NodeList nlist2=nlistNodeElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Node nameNode=nlist2.item(0);
  sponsorName=this.getElementValue(nameNode,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str");
  study.setSponsor(sponsorName);
  System.out.println("String_Node_Str" + sponsorName);
  return study;
}

Fixed version (ground truth):
public StudyBean getSponsorName(StudyBean study,Node studyNode) throws CCDataValidationFaultException {
  String sponsorName="String_Node_Str";
  Element studyElement=(Element)studyNode;
  NodeList nlist=studyElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Node nlistNode=nlist.item(0);
  Element nlistNodeElement=(Element)nlistNode;
  NodeList nlist2=nlistNodeElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  Node nameNode=nlist2.item(0);
  sponsorName=this.getElementValue(nameNode,CONNECTOR_NAMESPACE_V1,"String_Node_Str","String_Node_Str");
  study.setSponsor(sponsorName);
  return study;
}
Program: 115241
Project: 115241
Buggy source:
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  StudyEventBean newStudyEventBean=new StudyEventBean();
  newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
  newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
  newStudyEventBean.setStudyEventDefinition(sedBean);
  newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
  newStudyEventBean.setSampleOrdinal(getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean));
  newStudyEventBean.setStartTimeFlag(true);
  newStudyEventBean.setEndTimeFlag(false);
  newStudyEventBean.setOwner(getUserAccount());
  newStudyEventBean.setStatus(Status.AVAILABLE);
  newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
  newStudyEventBean.setStudySubject(studySubjectBean);
  newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
  newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
  return newStudyEventBean;
}

Fixed version (ground truth):
private StudyEventBean createNewStudyEventBean(StudyEventDefinitionBean sedBean,StudySubjectBean studySubjectBean){
  int ordinal=getStudyEventDao().getMaxSampleOrdinal(sedBean,studySubjectBean);
  StudyEventBean testStudyEventBean=(StudyEventBean)getStudyEventDao().findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubjectBean.getId(),sedBean.getId(),ordinal);
  if (testStudyEventBean != null && testStudyEventBean.getId() > 0) {
    return testStudyEventBean;
  }
 else {
    StudyEventBean newStudyEventBean=new StudyEventBean();
    newStudyEventBean.setCreatedDate(new Date(System.currentTimeMillis()));
    newStudyEventBean.setDateStarted(new Date(System.currentTimeMillis()));
    newStudyEventBean.setStudyEventDefinition(sedBean);
    newStudyEventBean.setStudyEventDefinitionId(sedBean.getId());
    newStudyEventBean.setSampleOrdinal(ordinal);
    newStudyEventBean.setStartTimeFlag(true);
    newStudyEventBean.setEndTimeFlag(false);
    newStudyEventBean.setOwner(getUserAccount());
    newStudyEventBean.setStatus(Status.AVAILABLE);
    newStudyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
    newStudyEventBean.setStudySubject(studySubjectBean);
    newStudyEventBean.setStudySubjectId(studySubjectBean.getId());
    newStudyEventBean=(StudyEventBean)getStudyEventDao().create(newStudyEventBean);
    return newStudyEventBean;
  }
}
Program: 115250
Project: 115250
Buggy source:
protected Element invokeInternal(Element requestElement,Document document) throws Exception {
  System.out.println("String_Node_Str");
  NodeList nlist=requestElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  this.logNodeList(nlist);
  return mapRegisterSubjectConfirmation("String_Node_Str");
}

Fixed version (ground truth):
protected Element invokeInternal(Element requestElement,Document document) throws Exception {
  System.out.println("String_Node_Str");
  NodeList nlist=requestElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  this.logNodeList(nlist);
  for (int i=0; i < nlist.getLength(); i++) {
    Node study=nlist.item(i);
    StudyBean studyBean=studyService.generateStudyBean(getUserAccount(),study);
  }
  return mapRegisterSubjectConfirmation("String_Node_Str");
}
Program: 115251
Project: 115251
Buggy source:
public CreateStudyEndpoint(DataSource dataSource,MessageSource messages,CoreResources coreResources){
  super(dataSource,messages,coreResources);
}

Fixed version (ground truth):
public CreateStudyEndpoint(DataSource dataSource,MessageSource messages,CoreResources coreResources){
  super(dataSource,messages,coreResources);
  studyService=new CreateStudyService();
}
Program: 115253
Project: 115253
Buggy source:
@Override public void init() throws ServletException {
  context=getServletContext();
  params=(Properties)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str");
  entParams=(Properties)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str");
  Role.COORDINATOR.setDescription(getField("String_Node_Str"));
  Role.STUDYDIRECTOR.setDescription(getField("String_Node_Str"));
  Role.INVESTIGATOR.setDescription(getField("String_Node_Str"));
  Role.RESEARCHASSISTANT.setDescription(getField("String_Node_Str"));
  Role.MONITOR.setDescription(getField("String_Node_Str"));
  String theDir=getField("String_Node_Str");
  String dir1="String_Node_Str" + File.separator;
  String dir2="String_Node_Str" + File.separator;
  if (!(new File(theDir)).isDirectory() || !(new File(dir1)).isDirectory() || !(new File(dir2)).isDirectory()) {
    (new File(theDir + dir1 + dir2)).mkdirs();
    copyTemplate(theDir + dir1 + dir2+ DownloadVersionSpreadSheetServlet.CRF_VERSION_TEMPLATE);
  }
  theDir=theDir + dir1 + dir2;
  File excelFile=new File(theDir + DownloadVersionSpreadSheetServlet.CRF_VERSION_TEMPLATE);
  if (!excelFile.isFile()) {
    copyTemplate(theDir);
  }
}

Fixed version (ground truth):
@Override public void init() throws ServletException {
  context=getServletContext();
  params=(Properties)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str");
  entParams=(Properties)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str");
  Role.COORDINATOR.setDescription(getField("String_Node_Str"));
  Role.STUDYDIRECTOR.setDescription(getField("String_Node_Str"));
  Role.INVESTIGATOR.setDescription(getField("String_Node_Str"));
  Role.RESEARCHASSISTANT.setDescription(getField("String_Node_Str"));
  Role.MONITOR.setDescription(getField("String_Node_Str"));
  String theDir=getField("String_Node_Str");
  String dir1="String_Node_Str" + File.separator;
  String dir2="String_Node_Str" + File.separator;
  String dirRules="String_Node_Str";
  if (!(new File(theDir)).isDirectory() || !(new File(dirRules)).isDirectory()) {
    (new File(theDir + dirRules)).mkdirs();
  }
  if (!(new File(theDir)).isDirectory() || !(new File(dir1)).isDirectory() || !(new File(dir2)).isDirectory()) {
    (new File(theDir + dir1 + dir2)).mkdirs();
    copyTemplate(theDir + dir1 + dir2+ DownloadVersionSpreadSheetServlet.CRF_VERSION_TEMPLATE);
  }
  theDir=theDir + dir1 + dir2;
  File excelFile=new File(theDir + DownloadVersionSpreadSheetServlet.CRF_VERSION_TEMPLATE);
  if (!excelFile.isFile()) {
    copyTemplate(theDir);
  }
}
Program: 115254
Project: 115254
Buggy source:
protected Element invokeInternal(Element requestElement,Document document) throws Exception {
  System.out.println("String_Node_Str");
  try {
    NodeList nlist=requestElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
    this.logNodeList(nlist);
    for (int i=0; i < nlist.getLength(); i++) {
      Node study=nlist.item(i);
      StudyBean studyBean=studyService.generateStudyBean(getUserAccount(),study);
      studyBean=(StudyBean)getStudyDao().create(studyBean);
    }
    return mapRegisterSubjectConfirmation("String_Node_Str");
  }
 catch (  Exception npe) {
    npe.printStackTrace();
    if (npe.getClass().getName().startsWith("String_Node_Str")) {
      System.out.println("String_Node_Str" + npe.getClass().getName());
      OpenClinicaException ope=(OpenClinicaException)npe;
      return mapSubjectErrorConfirmation("String_Node_Str",ope);
    }
 else {
      System.out.println("String_Node_Str" + npe.getClass().getName());
      return mapSubjectErrorConfirmation(npe.getMessage());
    }
  }
}

Fixed version (ground truth):
protected Element invokeInternal(Element requestElement,Document document) throws Exception {
  System.out.println("String_Node_Str");
  StudyBean studyBean=new StudyBean();
  studyBean.setIdentifier("String_Node_Str");
  try {
    NodeList nlist=requestElement.getElementsByTagNameNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
    this.logNodeList(nlist);
    for (int i=0; i < nlist.getLength(); i++) {
      Node study=nlist.item(i);
      studyBean=studyService.generateStudyBean(getUserAccount(),study);
      StudyBean testStudyBean=getStudyDao().findByUniqueIdentifier(studyBean.getIdentifier());
      if (testStudyBean.getId() > 0) {
        throw new CCBusinessFaultException("String_Node_Str" + studyBean.getIdentifier() + "String_Node_Str","String_Node_Str");
      }
      studyBean=(StudyBean)getStudyDao().create(studyBean);
    }
    return mapCreateStudyConfirmation(studyBean.getIdentifier());
  }
 catch (  Exception npe) {
    npe.printStackTrace();
    if (npe.getClass().getName().startsWith("String_Node_Str")) {
      System.out.println("String_Node_Str" + npe.getClass().getName());
      OpenClinicaException ope=(OpenClinicaException)npe;
      return mapStudyErrorConfirmation("String_Node_Str",ope);
    }
 else {
      System.out.println("String_Node_Str" + npe.getClass().getName());
      return mapStudyErrorConfirmation(npe.getMessage());
    }
  }
}
Program: 115255
Project: 115255
Buggy source:
public ArrayList<StudyBean> generateSites(UserAccountBean user,StudyBean parent,Node study){
  DomParsingService xmlService=new DomParsingService();
  ArrayList<StudyBean> sites=xmlService.getSites(parent,study);
  for (  StudyBean site : sites) {
    site.setOwner(user);
    site.setStatus(Status.AVAILABLE);
  }
  return sites;
}

Fixed version (ground truth):
public ArrayList<StudyBean> generateSites(UserAccountBean user,StudyBean parent,Node study) throws Exception {
  DomParsingService xmlService=new DomParsingService();
  ArrayList<StudyBean> sites=xmlService.getSites(parent,study);
  for (  StudyBean site : sites) {
    site.setOwner(user);
    site.setStatus(Status.AVAILABLE);
  }
  return sites;
}