Program: 115273
Project: 115273
Buggy source:
@Override public void processRequest() throws Exception {
  CRFDAO cdao=new CRFDAO(sm.getDataSource());
  CRFVersionDAO cvdao=new CRFVersionDAO(sm.getDataSource());
  FormProcessor fp=new FormProcessor(request);
  String module=fp.getString(MODULE);
  request.setAttribute(MODULE,module);
  int crfId=fp.getInt("String_Node_Str",true);
  String action=request.getParameter("String_Node_Str");
  if (crfId == 0) {
    addPageMessage(respage.getString("String_Node_Str"));
    forwardPage(Page.CRF_LIST_SERVLET);
  }
 else {
    CRFBean crf=(CRFBean)cdao.findByPK(crfId);
    ArrayList versions=cvdao.findAllByCRFId(crfId);
    crf.setVersions(versions);
    EventDefinitionCRFDAO edcdao=new EventDefinitionCRFDAO(sm.getDataSource());
    ArrayList edcs=(ArrayList)edcdao.findAllByCRF(crfId);
    SectionDAO secdao=new SectionDAO(sm.getDataSource());
    EventCRFDAO evdao=new EventCRFDAO(sm.getDataSource());
    ArrayList eventCRFs=evdao.findAllByCRF(crfId);
    if ("String_Node_Str".equalsIgnoreCase(action)) {
      request.setAttribute("String_Node_Str",crf);
      request.setAttribute("String_Node_Str",eventCRFs);
      forwardPage(Page.REMOVE_CRF);
    }
 else {
      logger.info("String_Node_Str");
      crf.setStatus(Status.DELETED);
      crf.setUpdater(ub);
      crf.setUpdatedDate(new Date());
      cdao.update(crf);
      for (int i=0; i < versions.size(); i++) {
        CRFVersionBean version=(CRFVersionBean)versions.get(i);
        if (!version.getStatus().equals(Status.DELETED)) {
          version.setStatus(Status.AUTO_DELETED);
          version.setUpdater(ub);
          version.setUpdatedDate(new Date());
          cvdao.update(version);
          ArrayList sections=secdao.findAllByCRFVersionId(version.getId());
          for (int j=0; j < sections.size(); j++) {
            SectionBean section=(SectionBean)sections.get(j);
            if (!section.getStatus().equals(Status.DELETED)) {
              section.setStatus(Status.AUTO_DELETED);
              section.setUpdater(ub);
              section.setUpdatedDate(new Date());
              secdao.update(section);
            }
          }
        }
      }
      for (int i=0; i < edcs.size(); i++) {
        EventDefinitionCRFBean edc=(EventDefinitionCRFBean)edcs.get(i);
        if (!edc.getStatus().equals(Status.DELETED)) {
          edc.setStatus(Status.AUTO_DELETED);
          edc.setUpdater(ub);
          edc.setUpdatedDate(new Date());
          edcdao.update(edc);
        }
      }
      ItemDataDAO idao=new ItemDataDAO(sm.getDataSource());
      for (int i=0; i < eventCRFs.size(); i++) {
        EventCRFBean eventCRF=(EventCRFBean)eventCRFs.get(i);
        if (!eventCRF.getStatus().equals(Status.DELETED)) {
          eventCRF.setStatus(Status.AUTO_DELETED);
          eventCRF.setUpdater(ub);
          eventCRF.setUpdatedDate(new Date());
          evdao.update(eventCRF);
          ArrayList items=idao.findAllByEventCRFId(eventCRF.getId());
          for (int j=0; j < items.size(); j++) {
            ItemDataBean item=(ItemDataBean)items.get(j);
            if (!item.getStatus().equals(Status.DELETED)) {
              item.setStatus(Status.AUTO_DELETED);
              item.setUpdater(ub);
              item.setUpdatedDate(new Date());
              idao.update(item);
            }
          }
        }
      }
      addPageMessage(respage.getString("String_Node_Str") + crf.getName() + "String_Node_Str"+ respage.getString("String_Node_Str"));
      forwardPage(Page.CRF_LIST_SERVLET);
    }
  }
}

Fixed version (ground truth):
@Override public void processRequest() throws Exception {
  CRFDAO cdao=new CRFDAO(sm.getDataSource());
  CRFVersionDAO cvdao=new CRFVersionDAO(sm.getDataSource());
  FormProcessor fp=new FormProcessor(request);
  String module=fp.getString(MODULE);
  request.setAttribute(MODULE,module);
  int crfId=fp.getInt("String_Node_Str",true);
  String action=request.getParameter("String_Node_Str");
  if (crfId == 0) {
    addPageMessage(respage.getString("String_Node_Str"));
    forwardPage(Page.CRF_LIST_SERVLET);
  }
 else {
    CRFBean crf=(CRFBean)cdao.findByPK(crfId);
    ArrayList versions=cvdao.findAllByCRFId(crfId);
    crf.setVersions(versions);
    EventDefinitionCRFDAO edcdao=new EventDefinitionCRFDAO(sm.getDataSource());
    ArrayList edcs=(ArrayList)edcdao.findAllByCRF(crfId);
    SectionDAO secdao=new SectionDAO(sm.getDataSource());
    EventCRFDAO evdao=new EventCRFDAO(sm.getDataSource());
    ArrayList eventCRFs=evdao.findAllByCRF(crfId);
    StudyEventDAO seDao=new StudyEventDAO(sm.getDataSource());
    StudyEventDefinitionDAO sedDao=new StudyEventDefinitionDAO(sm.getDataSource());
    for (    Object ecBean : eventCRFs) {
      StudyEventBean seBean=(StudyEventBean)seDao.findByPK(((EventCRFBean)ecBean).getStudyEventId());
      StudyEventDefinitionBean sedBean=(StudyEventDefinitionBean)sedDao.findByPK(seBean.getStudyEventDefinitionId());
      ((EventCRFBean)ecBean).setEventName(sedBean.getName());
    }
    if ("String_Node_Str".equalsIgnoreCase(action)) {
      request.setAttribute("String_Node_Str",crf);
      request.setAttribute("String_Node_Str",eventCRFs);
      forwardPage(Page.REMOVE_CRF);
    }
 else {
      logger.info("String_Node_Str");
      crf.setStatus(Status.DELETED);
      crf.setUpdater(ub);
      crf.setUpdatedDate(new Date());
      cdao.update(crf);
      for (int i=0; i < versions.size(); i++) {
        CRFVersionBean version=(CRFVersionBean)versions.get(i);
        if (!version.getStatus().equals(Status.DELETED)) {
          version.setStatus(Status.AUTO_DELETED);
          version.setUpdater(ub);
          version.setUpdatedDate(new Date());
          cvdao.update(version);
          ArrayList sections=secdao.findAllByCRFVersionId(version.getId());
          for (int j=0; j < sections.size(); j++) {
            SectionBean section=(SectionBean)sections.get(j);
            if (!section.getStatus().equals(Status.DELETED)) {
              section.setStatus(Status.AUTO_DELETED);
              section.setUpdater(ub);
              section.setUpdatedDate(new Date());
              secdao.update(section);
            }
          }
        }
      }
      for (int i=0; i < edcs.size(); i++) {
        EventDefinitionCRFBean edc=(EventDefinitionCRFBean)edcs.get(i);
        if (!edc.getStatus().equals(Status.DELETED)) {
          edc.setStatus(Status.AUTO_DELETED);
          edc.setUpdater(ub);
          edc.setUpdatedDate(new Date());
          edcdao.update(edc);
        }
      }
      ItemDataDAO idao=new ItemDataDAO(sm.getDataSource());
      for (int i=0; i < eventCRFs.size(); i++) {
        EventCRFBean eventCRF=(EventCRFBean)eventCRFs.get(i);
        if (!eventCRF.getStatus().equals(Status.DELETED)) {
          eventCRF.setStatus(Status.AUTO_DELETED);
          eventCRF.setUpdater(ub);
          eventCRF.setUpdatedDate(new Date());
          evdao.update(eventCRF);
          ArrayList items=idao.findAllByEventCRFId(eventCRF.getId());
          for (int j=0; j < items.size(); j++) {
            ItemDataBean item=(ItemDataBean)items.get(j);
            if (!item.getStatus().equals(Status.DELETED)) {
              item.setStatus(Status.AUTO_DELETED);
              item.setUpdater(ub);
              item.setUpdatedDate(new Date());
              idao.update(item);
            }
          }
        }
      }
      addPageMessage(respage.getString("String_Node_Str") + crf.getName() + "String_Node_Str"+ respage.getString("String_Node_Str"));
      forwardPage(Page.CRF_LIST_SERVLET);
    }
  }
}