Program: 115068
Project: 115068
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public String registerParticipate(@PathVariable("String_Node_Str") String studyOid,HttpServletRequest request) throws Exception {
  studyDao=new StudyDAO(dataSource);
  StudyBean study=studyDao.findByOid(studyOid);
  StudyParameterValueDAO spvdao=new StudyParameterValueDAO(dataSource);
  StudyParameterValueBean spv=spvdao.findByHandleAndStudy(study.getId(),"String_Node_Str");
  ParticipantPortalRegistrar registrar=new ParticipantPortalRegistrar();
  Locale locale=LocaleResolver.getLocale(request);
  ResourceBundleProvider.updateLocale(locale);
  respage=ResourceBundleProvider.getPageMessagesBundle(locale);
  String hostName=request.getParameter("String_Node_Str");
  if (hostName == null || hostName.equals("String_Node_Str")) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
  String status="String_Node_Str";
  String nameAvailability=registrar.getHostNameAvailability(hostName);
  if (nameAvailability.equals(ParticipantPortalRegistrar.UNAVAILABLE)) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
 else   if (nameAvailability.equals(ParticipantPortalRegistrar.UNKNOWN)) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
 else {
    status=registrar.registerStudy(study.getOid(),hostName);
  }
  if (status.equals("String_Node_Str")) {
    addRegMessage(request,respage.getString("String_Node_Str"));
  }
 else {
    spv.setStudyId(study.getId());
    spv.setParameter("String_Node_Str");
    spv.setValue("String_Node_Str");
    if (spv.getId() > 0)     spvdao.update(spv);
 else     spvdao.create(spv);
    StudyBean currentStudy=(StudyBean)request.getSession().getAttribute("String_Node_Str");
    currentStudy.getStudyParameterConfig().setParticipantPortal("String_Node_Str");
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public String registerParticipate(@PathVariable("String_Node_Str") String studyOid,HttpServletRequest request) throws Exception {
  studyDao=new StudyDAO(dataSource);
  StudyBean study=studyDao.findByOid(studyOid);
  StudyParameterValueDAO spvdao=new StudyParameterValueDAO(dataSource);
  StudyParameterValueBean spv=spvdao.findByHandleAndStudy(study.getId(),"String_Node_Str");
  ParticipantPortalRegistrar registrar=new ParticipantPortalRegistrar();
  Locale locale=LocaleResolver.getLocale(request);
  ResourceBundleProvider.updateLocale(locale);
  respage=ResourceBundleProvider.getPageMessagesBundle(locale);
  String hostName=request.getParameter("String_Node_Str");
  if (hostName == null || hostName.equals("String_Node_Str")) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
  String status="String_Node_Str";
  String nameAvailability=registrar.getHostNameAvailability(hostName);
  if (nameAvailability.equals(ParticipantPortalRegistrar.UNAVAILABLE)) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
 else   if (nameAvailability.equals(ParticipantPortalRegistrar.UNKNOWN)) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
 else   if (nameAvailability.equals(ParticipantPortalRegistrar.INVALID)) {
    addRegMessage(request,respage.getString("String_Node_Str"));
    return "String_Node_Str";
  }
 else {
    status=registrar.registerStudy(study.getOid(),hostName);
  }
  if (status.equals("String_Node_Str")) {
    addRegMessage(request,respage.getString("String_Node_Str"));
  }
 else {
    spv.setStudyId(study.getId());
    spv.setParameter("String_Node_Str");
    spv.setValue("String_Node_Str");
    if (spv.getId() > 0)     spvdao.update(spv);
 else     spvdao.create(spv);
    StudyBean currentStudy=(StudyBean)request.getSession().getAttribute("String_Node_Str");
    currentStudy.getStudyParameterConfig().setParticipantPortal("String_Node_Str");
  }
  return "String_Node_Str";
}