Buggy code:
public void run ( ) { } protected WOSession ses ; protected EOEditingContext ec ; protected void doBroadcast ( NSDictionary params ) { NSArray students = ( ( NSArray ) ( params . valueForKey ( "students" ) ) ) ; if ( ( students == null ) || ( ( students . count ( ) ) == 0 ) ) return ; EMailBroadcast . logger . log ( FINEST , ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + '(' ) + ( + ( Thread . currentThread ( ) . getId ( ) ) ) ) + ")<seq2seq4repair_space>Starting<seq2seq4repair_space>broadcast<seq2seq4repair_space>for" ) , new Object [ ] { ses , params . valueForKey ( "logParam" ) } ) ; NSArray existingCourses = ( ( NSArray ) ( params . valueForKey ( "courses" ) ) ) ; Period period = ( ( Period ) ( params . valueForKey ( "period" ) ) ) ; WOContext ctx = ( ( WOContext ) ( params . valueForKey ( "ctx" ) ) ) ; if ( ctx == null ) { if ( ctx == null ) { ctx = MyUtility . dummyContext ( ses ) ; } if ( ( ses ) == null ) { ses = ctx . session ( ) ; NSTimestamp date = ( ( NSTimestamp ) ( params . valueForKey ( "date" ) ) ) ; if ( date == null ) date = ( ( NSTimestamp ) ( params . valueForKey ( "to" ) ) ) ; if ( ( date == null ) && ( period != null ) ) date = new NSTimestamp ( period . end ( ) ) ; if ( date != null ) ses . takeValueForKey ( date , "today" ) ; } else { ctx . _setSession ( ses ) ; } WeakReference sesRef = ( ( WeakReference ) ( params . valueForKey ( "callerSession" ) ) ) ; WOSession callerSession = ( sesRef == null ) ? null : ( ( WOSession ) ( sesRef . get ( ) ) ) ; if ( callerSession != null ) { Object reportSettings = callerSession . objectForKey ( "reportSettingsForStudent" ) ; if ( reportSettings != null ) ses . setObjectForKey ( reportSettings , "reportSettingsForStudent" ) ; } } if ( ( ec ) == null ) ec = ( ( EOEditingContext ) ( params . valueForKey ( "editingContext" ) ) ) ; if ( ( ( ec ) != null ) && ( ! ( ( ec ) instanceof SessionedEditingContext ) ) ) ec = null ; if ( ( ec ) instanceof SessionedEditingContext ) { Object user = ( ( SessionedEditingContext ) ( ec ) ) . session ( ) . valueForKey ( "user" ) ; if ( ( user == null ) || ( ! ( user . toString ( ) . startsWith ( "DummyUser" ) ) ) ) ec = null ; } if ( ( ec ) == null ) { EOObjectStore os = ( ( EOObjectStore ) ( ses . objectForKey ( "objectStore" ) ) ) ; os = EOObjectStoreCoordinator . defaultCoordinator ( ) ; ec = new SessionedEditingContext ( os , ctx . session ( ) ) ; params . takeValueForKey ( ec , "editingContext" ) ; } students = EOUtilities . localInstancesOfObjects ( ec , students ) ; params . takeValueForKey ( students , "students" ) ; existingCourses = EOUtilities . localInstancesOfObjects ( ec , existingCourses ) ; if ( period instanceof EOEnterpriseObject ) { period = ( ( Period ) ( EOUtilities . localInstanceOfObject ( ec , ( ( EOEnterpriseObject ) ( period ) ) ) ) ) ; } PerPersonLink contacts = Contact . getContactsForList ( students , EMailUtiliser . conType ( ec ) ) ; if ( contacts == null ) { EMailBroadcast . logger . log ( FINEST , ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + '(' ) + ( + ( Thread . currentThread ( ) . getId ( ) ) ) ) + ")<seq2seq4repair_space>No<seq2seq4repair_space>contacts<seq2seq4repair_space>found" ) , new Object [ ] { ses , params . valueForKey ( "logParam" ) } ) ; return ; } NSDictionary reporter = ( ( NSDictionary ) ( params . valueForKey ( "reporter" ) ) ) ; <START_BUG> if ( reporter == null ) { <END_BUG> StudentReports reports = new StudentReports ( ses ) ; reporter = ( ( NSDictionary ) ( reports . defaultReporter ( ) ) ) ; } String groupName = ( ( String ) ( params . valueForKey ( "groupName" ) ) ) ; long timeout = 0 ; try { String lag = SettingsReader . stringForKeyPath ( "mail.messageLag" , null ) ; if ( lag != null ) timeout = Long . parseLong ( lag ) ; } catch ( Exception ex ) { EMailBroadcast . logger . log ( INFO , "Failed<seq2seq4repair_space>to<seq2seq4repair_space>define<seq2seq4repair_space>message<seq2seq4repair_space>lag" , new Object [ ] { ses , ex } ) ; timeout = 0 ; } Mailer mailer = ( ( Mailer ) ( params . valueForKey ( "mailer" ) ) ) ; if ( mailer == null ) { mailer = new Mailer ( ) ; EMailBroadcast . logger . log ( FINEST , "Mailer<seq2seq4repair_space>instantiated" , ses ) ; } StringBuffer textBuf = new StringBuffer ( ) ; boolean allowRequest = false ; if ( reporter != null ) { String text = ( ( String ) ( reporter . valueForKey ( "winTitle" ) ) ) ; if ( text == null ) text = ( ( String ) ( reporter . valueForKey ( "title" ) ) ) ; if ( text == null ) text = ( ( String ) ( reporter . valueForKey ( "component" ) ) ) ; if ( text != null ) textBuf . append ( text ) ; textBuf . append ( '<seq2seq4repair_space>' ) ; textBuf . append ( WOApplication . application ( ) . valueForKeyPath ( "strings.RujelContacts_Contacts.isInAttachment" ) ) ;

Fix:
if ( ( reporter != null ) && ( ( reporter . count ( ) ) == 0 ) ) {