Program: 115243
Project: 115243
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 this.mapLoadLabsConfirmation();
}

Fixed version (ground truth):
/** 
 * Load Labs Rollback, tbh 02/2011 The difference between rollback here and rollback elsewhere; we are deleting event crfs and data, per the logic described originally in DeleteEventCRFServlet, from the web branch of OpenClinica.
 */
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);
  try {
    LoadLabsService labService=new LoadLabsService();
    ODMContainer odmContainer=labService.generateLoadLabsObject(requestElement,getStudyDao(),getSubjectDao(),getItemDao(),getStudySubjectDao(),getItemGroupDao(),getCrfVersionDao(),getStudyEventDefinitionDao());
    StudyBean studyBean=getStudyDao().findByOid(odmContainer.getCrfDataPostImportContainer().getStudyOID());
    SubjectBean subjectBean=getSubjectDao().findByUniqueIdentifier(odmContainer.getSubjectUniqueIdentifier());
    StudySubjectBean studySubjectBean=getStudySubjectDao().findBySubjectIdAndStudy(subjectBean.getId(),studyBean);
    StudyEventDefinitionBean studyEventDefBean=getStudyEventDefinitionDao().findByOid(odmContainer.getCrfDataPostImportContainer().getSubjectData().get(0).getStudyEventData().get(0).getStudyEventOID());
    CRFVersionBean crfVersionBean=getCrfVersionDao().findByOid(odmContainer.getCrfDataPostImportContainer().getSubjectData().get(0).getStudyEventData().get(0).getFormData().get(0).getFormOID());
    int ordinal=getStudyEventDao().getMaxSampleOrdinal(studyEventDefBean,studySubjectBean);
    StudyEventBean studyEventBean=(StudyEventBean)getStudyEventDao().findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubjectBean.getId(),studyEventDefBean.getId(),ordinal);
    System.out.println("String_Node_Str" + studyEventBean.getId() + "String_Node_Str"+ studyEventBean.getSampleOrdinal());
    EventCRFBean eventCrfBean=(EventCRFBean)getEventCrfDao().findByEventCrfVersion(studyEventBean,crfVersionBean);
    System.out.println("String_Node_Str" + eventCrfBean.getId() + "String_Node_Str");
    DiscrepancyNoteDAO discNoteDao=new DiscrepancyNoteDAO(dataSource);
    ArrayList<ItemDataBean> itemData=getItemDataDao().findAllByEventCRFId(eventCrfBean.getId());
    logger.info("String_Node_Str");
    for (    ItemDataBean item : itemData) {
      ArrayList<DiscrepancyNoteBean> discrepancyList=discNoteDao.findExistingNotesForItemData(item.getId());
      getItemDataDao().deleteDnMap(item.getId());
      for (      DiscrepancyNoteBean noteBean : discrepancyList) {
        discNoteDao.deleteNotes(noteBean.getId());
      }
      item.setUpdater(getUserAccount());
      getItemDataDao().updateUser(item);
      getItemDataDao().delete(item.getId());
    }
    getEventCrfDao().delete(eventCrfBean.getId());
  }
 catch (  Exception e) {
    e.printStackTrace();
    if (e.getClass().getName().startsWith("String_Node_Str")) {
      System.out.println("String_Node_Str" + e.getClass().getName());
      OpenClinicaException ope=(OpenClinicaException)e;
      return mapLoadLabsErrorConfirmation("String_Node_Str",ope);
    }
 else {
      System.out.println("String_Node_Str" + e.getClass().getName());
      return mapLoadLabsErrorConfirmation(e.getMessage(),new CCBusinessFaultException("String_Node_Str","String_Node_Str"));
    }
  }
  return this.mapLoadLabsConfirmation();
}