Buggy code:
public class Calendar { private String name ; public User owner ; private PriorityQueue < Event > events ; public long id ; private LinkedList < Event > repeatingEvents ; private static long counter ; public Calendar ( String name , User owner ) { } public User getOwner ( ) { } public String getName ( ) { } public long getId ( ) { } public void addEvent ( Event e ) { } private boolean compareCalendarEvents ( Event ev1 ) { } public void addToRepeated ( Event e ) { } public LinkedList < Event > getDayEvents ( Date day , User requester ) { } public Iterator < Event > getEventList ( Date start , User requester ) { } public LinkedList < Event > getEventsOfDay ( int day , int month , int year , User requester ) { } public boolean hasEventOnDay ( int day , int month , int year , User requester ) { } public boolean hasEventOnDay ( Date date , User requester ) { } private boolean containsSameElement ( LinkedList < Event > events , Event repeatingEvent ) { } public Event getEventById ( long id ) { } public void removeEvent ( long id ) { if ( getEventById ( id ) . is_repeating ) { LinkedList < Event > events = new LinkedList < Event > ( this . events ) ; System . out . println ( "i<seq2seq4repair_space>am<seq2seq4repair_space>repeating" ) ; for ( Event e : events ) { if ( ( e . getId ( ) ) == id ) { Event baseEvent = getEventById ( e . baseID ) ; int intervall = baseEvent . intervall ; Date nextRepStartDate = new Date ( e . start . getYear ( ) , e . start . getMonth ( ) , ( ( e . start . getDate ( ) ) + intervall ) , e . start . getHours ( ) , e . start . getMinutes ( ) ) ; Date nextRepEndDate = new Date ( e . end . getYear ( ) , e . end . getMonth ( ) , ( ( e . end . getDate ( ) ) + intervall ) , e . start . getHours ( ) , e . start . getMinutes ( ) ) ; Event nextEvent = new Event ( nextRepStartDate , nextRepEndDate , e . name , e . is_visible , true , intervall ) ; nextEvent . baseID = nextEvent . id ; LinkedList < Date > previousDates = new LinkedList < Date > ( ) ; if ( ( intervall == 7 ) || ( intervall == 1 ) ) { Date current = baseEvent . start ; while ( ( current . compareTo ( nextRepStartDate ) ) == ( - 1 ) ) { if ( hasEventOnDay ( current , owner ) ) { LinkedList < Event > dayevents = getDayEvents ( current , owner ) ; if ( hasName ( e . name , dayevents ) ) previousDates . add ( current ) ; } current = new Date ( current . getYear ( ) , current . getMonth ( ) , ( ( current . getDate ( ) ) + intervall ) , current . getHours ( ) , current . getMinutes ( ) ) ; } previousDates . removeLast ( ) ; } removeRepeatingEvents ( baseEvent ) ; for ( Date d : previousDates ) { <START_BUG> Event ev = new Event ( d , d , e . name , e . is_visible , true , intervall ) ; <END_BUG> this . events . add ( ev ) ; } if ( ! ( compareCalendarEvents ( nextEvent ) ) ) { this . events . add ( nextEvent ) ; if ( nextEvent . isRepeating ( ) ) { repeatingEvents . add ( nextEvent ) ; } } } } } else { LinkedList < Event > events = new LinkedList < Event > ( this . events ) ; System . out . println ( "im<seq2seq4repair_space>NOT<seq2seq4repair_space>repeating" ) ; for ( Event e : events ) if ( ( e . getId ( ) ) == id ) { this . events . remove ( e ) ; this . repeatingEvents . remove ( e ) ; } } } public void removeRepeatingEvents ( Event event ) { } public PriorityQueue < Event > getEvents ( ) { } public LinkedList < Event > getRepeatingEvents ( ) { } private boolean hasName ( String name , LinkedList < Event > dayevents ) { } }

Fix:
Event ev = new Event ( d , d , e . name , e . is_visible , false , intervall ) ;