Buggy code:
public class GCalAddEvent implements Module { public static Logger log = new Logger ( "GCalAddEvent" , Level . DEBUG ) ; DialogueSystem system ; boolean paused = true ; CalendarManager eventManager = new CalendarManager ( ) ; public GCalAddEvent ( DialogueSystem system ) { } @ Override public void start ( ) throws DialException { } @ Override public void trigger ( DialogueState state , Collection < String > updatedVars ) { if ( ( updatedVars . contains ( "a_m" ) ) && ( state . hasChanceNode ( "a_m" ) ) ) { String action = state . queryProb ( "a_m" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; String current_event = state . queryProb ( "current_step" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; if ( current_event . equals ( "Confirm_Event" ) ) { <START_BUG> String [ ] eventData = new String [ 6 ] ; <END_BUG> String EventType = state . queryProb ( "EventType" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; eventData [ 0 ] = EventType ; String Date = state . queryProb ( "Date" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; EventType = EventType . toLowerCase ( ) ; eventData [ 1 ] = Date ; String Place = state . queryProb ( "Place" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; eventData [ 2 ] = Place ; String Person = state . queryProb ( "Person" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; String Gift = state . queryProb ( "Gift" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; String DressCode = state . queryProb ( "DressCode" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; String Subject = state . queryProb ( "Subject" ) . toDiscrete ( ) . getBest ( ) . toString ( ) ; System . out . println ( "info:<seq2seq4repair_space>type,<seq2seq4repair_space>data,<seq2seq4repair_space>place,<seq2seq4repair_space>person,<seq2seq4repair_space>gift,<seq2seq4repair_space>dresscode,<seq2seq4repair_space>subject" ) ; System . out . println ( ( ( ( ( ( ( ( ( ( ( ( ( EventType + "<seq2seq4repair_space>" ) + Date ) + "<seq2seq4repair_space>" ) + Place ) + "<seq2seq4repair_space>" ) + Person ) + "<seq2seq4repair_space>" ) + Gift ) + "<seq2seq4repair_space>" ) + DressCode ) + "<seq2seq4repair_space>" ) + Subject ) ) ; if ( ( EventType . contains ( "birthday" ) ) || ( EventType . contains ( "party" ) ) ) { eventData [ 3 ] = Person ; if ( ! ( Gift . equals ( "NoGift" ) ) ) eventData [ 4 ] = "Gift:<seq2seq4repair_space>" + Gift ; if ( ! ( DressCode . equals ( "NoDressCode" ) ) ) eventData [ 5 ] = "Dress<seq2seq4repair_space>Code:<seq2seq4repair_space>" + DressCode ; } if ( EventType . contains ( "anniversary" ) ) { eventData [ 3 ] = Person ; if ( ! ( Gift . equals ( "NoGift" ) ) ) eventData [ 4 ] = "Gift:<seq2seq4repair_space>" + Gift ; if ( ! ( DressCode . equals ( "NoDressCode" ) ) ) eventData [ 5 ] = "Dress<seq2seq4repair_space>Code:<seq2seq4repair_space>" + DressCode ; eventData [ 6 ] = "type:<seq2seq4repair_space>" + Subject ; } if ( EventType . contains ( "chill" ) ) { eventData [ 3 ] = Person ; if ( ! ( DressCode . equals ( "NoDressCode" ) ) ) eventData [ 5 ] = "Dress<seq2seq4repair_space>Code:<seq2seq4repair_space>" + DressCode ; } if ( EventType . contains ( "exam" ) ) { eventData [ 6 ] = "Subject:<seq2seq4repair_space>" + Subject ; } if ( ( EventType . contains ( "seminar" ) ) || ( EventType . contains ( "job" ) ) ) { eventData [ 3 ] = Person ; if ( ! ( DressCode . equals ( "NoDressCode" ) ) ) eventData [ 5 ] = "Dress<seq2seq4repair_space>Code:<seq2seq4repair_space>" + DressCode ; eventData [ 6 ] = "Subject:<seq2seq4repair_space>" + Subject ; } if ( EventType . contains ( "graduation" ) ) { eventData [ 3 ] = Person ; if ( ! ( Gift . equals ( "NoGift" ) ) ) eventData [ 4 ] = "Gift:<seq2seq4repair_space>" + Gift ; } System . out . println ( "Creating<seq2seq4repair_space>Event!" ) ; try { eventManager . addNewEvent ( eventData ) ; System . out . println ( ( "Adding<seq2seq4repair_space>event<seq2seq4repair_space>as<seq2seq4repair_space>" + EventType ) ) ; } catch ( Exception e ) { System . out . println ( e . toString ( ) ) ; } system . addContent ( new Assignment ( "a_m" , "Confirm" ) ) ; System . out . println ( "Event<seq2seq4repair_space>Added<seq2seq4repair_space>successfully!" ) ; } } } @ Override public void pause ( boolean toPause ) { } @ Override public boolean isRunning ( ) { } }

Fix:
String [ ] eventData = new String [ 7 ] ;