Program: 115087
Project: 115087
Buggy source:
/** 
 * The Event action runs based on the values set in the rules.
 * @param result
 * @param propertyBean
 * @param eow
 * @param eventAction
 */
private void executeAction(Object result,PropertyBean propertyBean,ExpressionBeanObjectWrapper eow,EventActionBean eventAction,Integer userId){
  String oid=eventAction.getOc_oid_reference();
  String eventOID=null;
  DateFormat df=new SimpleDateFormat("String_Node_Str");
  int ordinal=1;
  if (oid.startsWith(ExpressionService.STUDY_EVENT_OID_START_KEY)) {
    StudyEvent studyEvent=null;
    if (oid.contains("String_Node_Str")) {
      int leftBracketIndex=oid.indexOf("String_Node_Str");
      int rightBracketIndex=oid.indexOf("String_Node_Str");
      ordinal=Integer.valueOf(oid.substring(leftBracketIndex + 1,rightBracketIndex));
      eventOID=oid.substring(0,leftBracketIndex);
      studyEvent=getStudyEventDAO().fetchByStudyEventDefOIDAndOrdinal(eventOID,ordinal,eow.getStudySubjectBeanId());
    }
 else {
      eventOID=oid;
      studyEvent=getStudyEventDAO().fetchByStudyEventDefOIDAndOrdinal(oid,1,eow.getStudySubjectBeanId());
    }
    StudyEventChangeDetails changeDetails=new StudyEventChangeDetails();
    if (studyEvent == null) {
      studyEvent=new StudyEvent();
      StudySubject ss=getStudySubjectDao().findById(eow.getStudySubjectBeanId());
      StudyEventDefinition sed=getStudyEventDefinitionDao().findByColumnName(eventOID,"String_Node_Str");
      studyEvent.setStudyEventDefinition(sed);
      studyEvent.setStudySubject(ss);
      studyEvent.setStatusId(1);
      studyEvent.setSampleOrdinal(ordinal);
      studyEvent.setSubjectEventStatusId(new Integer(1));
      studyEvent.setStartTimeFlag(false);
      studyEvent.setEndTimeFlag(false);
      studyEvent.setDateCreated(new Date());
      studyEvent.setUserAccount(getUserAccountDao().findById(userId));
      changeDetails.setStartDateChanged(true);
      changeDetails.setStatusChanged(true);
    }
 else {
      studyEvent.setUpdateId(userId);
      studyEvent.setDateUpdated(new Date());
      changeDetails.setStatusChanged(false);
    }
    try {
      if (studyEvent.getDateStart() == null || studyEvent.getDateStart().compareTo(df.parse((String)result)) != 0)       changeDetails.setStartDateChanged(true);
      studyEvent.setDateStart(df.parse((String)result));
    }
 catch (    ParseException e) {
      e.printStackTrace();
      LOGGER.info(e.getMessage());
    }
    StudyEventContainer container=new StudyEventContainer(studyEvent,changeDetails);
    getStudyEventDAO().saveOrUpdate(container);
  }
}

Fixed version (ground truth):
/** 
 * The Event action runs based on the values set in the rules.
 * @param result
 * @param propertyBean
 * @param eow
 * @param eventAction
 */
private void executeAction(Object result,PropertyBean propertyBean,ExpressionBeanObjectWrapper eow,EventActionBean eventAction,Integer userId){
  String oid=eventAction.getOc_oid_reference();
  String eventOID=null;
  DateFormat df=new SimpleDateFormat("String_Node_Str");
  int ordinal=1;
  if (oid.startsWith(ExpressionService.STUDY_EVENT_OID_START_KEY)) {
    StudyEvent studyEvent=null;
    if (oid.contains("String_Node_Str")) {
      int leftBracketIndex=oid.indexOf("String_Node_Str");
      int rightBracketIndex=oid.indexOf("String_Node_Str");
      ordinal=Integer.valueOf(oid.substring(leftBracketIndex + 1,rightBracketIndex));
      eventOID=oid.substring(0,leftBracketIndex);
      studyEvent=getStudyEventDAO().fetchByStudyEventDefOIDAndOrdinal(eventOID,ordinal,eow.getStudySubjectBeanId());
    }
 else {
      eventOID=oid;
      studyEvent=getStudyEventDAO().fetchByStudyEventDefOIDAndOrdinal(oid,ordinal,eow.getStudySubjectBeanId());
    }
    StudyEventChangeDetails changeDetails=new StudyEventChangeDetails();
    if (studyEvent == null) {
      studyEvent=new StudyEvent();
      StudySubject ss=getStudySubjectDao().findById(eow.getStudySubjectBeanId());
      StudyEventDefinition sed=getStudyEventDefinitionDao().findByColumnName(eventOID,"String_Node_Str");
      studyEvent.setStudyEventDefinition(sed);
      studyEvent.setStudySubject(ss);
      studyEvent.setStatusId(1);
      studyEvent.setSampleOrdinal(getNewEventOrdinal(eventOID,eow.getStudySubjectBeanId(),sed));
      studyEvent.setSubjectEventStatusId(new Integer(1));
      studyEvent.setStartTimeFlag(false);
      studyEvent.setEndTimeFlag(false);
      studyEvent.setDateCreated(new Date());
      studyEvent.setUserAccount(getUserAccountDao().findById(userId));
      changeDetails.setStartDateChanged(true);
      changeDetails.setStatusChanged(true);
    }
 else {
      studyEvent.setUpdateId(userId);
      studyEvent.setDateUpdated(new Date());
      changeDetails.setStatusChanged(false);
    }
    try {
      if (studyEvent.getDateStart() == null || studyEvent.getDateStart().compareTo(df.parse((String)result)) != 0)       changeDetails.setStartDateChanged(true);
      studyEvent.setDateStart(df.parse((String)result));
    }
 catch (    ParseException e) {
      e.printStackTrace();
      LOGGER.info(e.getMessage());
    }
    StudyEventContainer container=new StudyEventContainer(studyEvent,changeDetails);
    getStudyEventDAO().saveOrUpdate(container);
  }
}