Buggy code:
i < ( DAs . size ( ) ) ; i ++ ) { historyRS = StringUtils . noNull ( DAs . get ( i ) . getRosterStatus ( ) ) ; historyRS1 = ( i < ( ( DAs . size ( ) ) - 1 ) ) ? StringUtils . noNull ( DAs . get ( ( i + 1 ) ) . getRosterStatus ( ) ) : "-1" ; historyRS = ( historyRS . equalsIgnoreCase ( "RO" ) ) ? "1" : "0" ; historyRS1 = ( historyRS1 . equalsIgnoreCase ( "RO" ) ) ? "1" : "0" ; historyRD = DAs . get ( i ) . getRosterDate ( ) ; historyRD1 = ( i < ( ( DAs . size ( ) ) - 1 ) ) ? DAs . get ( ( i + 1 ) ) . getRosterDate ( ) : null ; historyTD = DAs . get ( i ) . getRosterTerminationDate ( ) ; historyTD1 = ( i < ( ( DAs . size ( ) ) - 1 ) ) ? DAs . get ( ( i + 1 ) ) . getRosterTerminationDate ( ) : null ; if ( i == 0 ) { String rd = UtilDateUtilities . DateToString ( historyRD ) ; String td = UtilDateUtilities . DateToString ( historyTD ) ; if ( ( ( historyRS . equals ( rosterStatus ) ) && ( rd . equals ( rosterDate ) ) ) && ( td . equals ( rosterTermDate ) ) ) continue ; } else { if ( ( ( historyRS . equals ( historyRS1 ) ) && ( ( UtilDateUtilities . nullSafeCompare ( historyRD , historyRD1 ) ) == 0 ) ) && ( ( UtilDateUtilities . nullSafeCompare ( historyTD , historyTD1 ) ) == 0 ) ) continue ; } enrolment = demo . addNewEnrolment ( ) ; enrolment . setEnrollmentStatus ( cdsDt . EnrollmentStatus . Enum . forString ( historyRS ) ) ; if ( historyRS . equals ( "1" ) ) { if ( historyRD != null ) enrolment . setEnrollmentDate ( Util . calDate ( historyRD ) ) ; } else { if ( historyTD != null ) enrolment . setEnrollmentTerminationDate ( Util . calDate ( historyTD ) ) ; String termReason = DAs . get ( i ) . getRosterTerminationReason ( ) ; if ( StringUtils . filled ( termReason ) ) enrolment . setTerminationReason ( cdsDt . TerminationReasonCode . Enum . forString ( termReason ) ) ; } } String patientStatus = StringUtils . noNull ( demographic . getPatientStatus ( ) ) ; Demographics . PersonStatusCode personStatusCode = demo . addNewPersonStatusCode ( ) ; if ( StringUtils . empty ( patientStatus ) ) { patientStatus = "" ; exportError . add ( ( "Error!<seq2seq4repair_space>No<seq2seq4repair_space>Person<seq2seq4repair_space>Status<seq2seq4repair_space>Code<seq2seq4repair_space>for<seq2seq4repair_space>Patient<seq2seq4repair_space>" + demoNo ) ) ; } if ( patientStatus . equalsIgnoreCase ( "AC" ) ) personStatusCode . setPersonStatusAsEnum ( A ) ; else if ( patientStatus . equalsIgnoreCase ( "IN" ) ) personStatusCode . setPersonStatusAsEnum ( I ) ; else if ( patientStatus . equalsIgnoreCase ( "DE" ) ) personStatusCode . setPersonStatusAsEnum ( D ) ; else { if ( "MO" . equalsIgnoreCase ( patientStatus ) ) patientStatus = "Moved" ; else if ( "FI" . equalsIgnoreCase ( patientStatus ) ) patientStatus = "Fired" ; personStatusCode . setPersonStatusAsPlainText ( patientStatus ) ; } String patientStatusDate = "" ; if ( ( demographic . getPatientStatusDate ( ) ) != null ) patientStatusDate = formatter . format ( demographic . getPatientStatusDate ( ) ) ; if ( StringUtils . filled ( patientStatusDate ) ) demo . setPersonStatusDate ( Util . calDate ( patientStatusDate ) ) ; String demoNotes = d . getDemographicNotes ( demoNo ) ; if ( StringUtils . filled ( demoNotes ) ) demo . setNoteAboutPatient ( demoNotes ) ; String dob = StringUtils . noNull ( DemographicData . getDob ( demographic , "-" ) ) ; demo . setDateOfBirth ( Util . calDate ( dob ) ) ; <START_BUG> if ( ( UtilDateUtilities . StringToDate ( dob ) ) == null ) { <END_BUG> exportError . add ( ( "Error!<seq2seq4repair_space>No<seq2seq4repair_space>Date<seq2seq4repair_space>Of<seq2seq4repair_space>Birth<seq2seq4repair_space>for<seq2seq4repair_space>Patient<seq2seq4repair_space>" + demoNo ) ) ; } else if ( ( UtilDateUtilities . StringToDate ( dob ) ) == null ) { exportError . add ( ( "Not<seq2seq4repair_space>exporting<seq2seq4repair_space>invalid<seq2seq4repair_space>Date<seq2seq4repair_space>of<seq2seq4repair_space>Birth<seq2seq4repair_space>for<seq2seq4repair_space>Patient<seq2seq4repair_space>" + demoNo ) ) ; } String chartNo = demographic . getChartNo ( ) ; if ( StringUtils . filled ( chartNo ) ) demo . setChartNumber ( chartNo ) ; String email = demographic . getEmail ( ) ; if ( StringUtils . filled ( email ) ) demo . setEmail ( email ) ; String providerNo = demographic . getProviderNo ( ) ; if ( StringUtils . filled ( providerNo ) ) { Demographics . PrimaryPhysician pph = demo . addNewPrimaryPhysician ( ) ; ProviderData prvd = new ProviderData ( providerNo ) ; if ( ( StringUtils . noNull ( prvd . getOhip_no ( ) ) . length ( ) ) <= 6 ) pph . setOHIPPhysicianId ( prvd . getOhip_no ( ) ) ; Util . writeNameSimple ( pph . addNewName ( ) , prvd . getFirst_name ( ) , prvd . getLast_name ( ) ) ; String cpso = prvd . getPractitionerNo ( ) ; if ( ( cpso != null ) && ( ( cpso . length ( ) ) == 5 ) ) pph . setPrimaryPhysicianCPSO ( cpso ) ; } if ( StringUtils . filled ( demographic . getSin ( ) ) ) { demo . setSIN ( demographic . getSin ( ) ) ; } if ( StringUtils . filled ( demographic . getHin ( ) ) ) { HealthCard healthCard = demo . addNewHealthCard ( ) ; healthCard . setNumber ( demographic . getHin ( ) ) ; if ( ( Util . setProvinceCode ( demographic . getHcType ( ) ) ) != null ) healthCard . setProvinceCode ( Util . setProvinceCode ( demographic . getHcType ( ) ) ) ;

Fix:
if ( "" . equals ( dob ) ) {