Buggy code:
public class Controller { private static Controller controller ; private String saveFileName ; private Storage storage ; private boolean timeToExit ; private ArrayList < Task > allTasks ; private ObservableList < Task > displayedTasks = FXCollections . observableArrayList ( ) ; private Stack < ArrayList < Task > > previousStates ; private Stack < ObservableList < Task > > previousStatesDisplayed ; private String searchArgument ; private DateParser parser ; private boolean switchDisplay = false ; private UserDefinedSort uds ; private Display display ; private Stage stage ; private static final String TASK_OVERVIEW_LOCATION = "//view//TaskOverview.fxml" ; private static final String MESSAGE_SAVE_FILE_READY = "Welcome<seq2seq4repair_space>to<seq2seq4repair_space>main.java.Veto.<seq2seq4repair_space>%s<seq2seq4repair_space>is<seq2seq4repair_space>ready<seq2seq4repair_space>for<seq2seq4repair_space>use." ; private static final String MESSAGE_ADD = "Task<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>added:<seq2seq4repair_space>" ; private static final String MESSAGE_DELETE = "Task<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>deleted:<seq2seq4repair_space>" ; private static final String MESSAGE_EDIT = "Task<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>successfully<seq2seq4repair_space>edited.\n" ; private static final String MESSAGE_EDIT_FAILED = "Task<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>edited.\n" ; private static final String MESSAGE_COMPLETE = "\"%s\"<seq2seq4repair_space>completed.<seq2seq4repair_space>\n" ; private static final String MESSAGE_COMPLETE_FAILED = "\"%s\"<seq2seq4repair_space>already<seq2seq4repair_space>completed.<seq2seq4repair_space>\n" ; private static final String MESSAGE_INCOMPLETE = "\"%s\"<seq2seq4repair_space>marked<seq2seq4repair_space>as<seq2seq4repair_space>incomplete.<seq2seq4repair_space>\n" ; private static final String MESSAGE_EXIT = "Goodbye!" ; private static final String MESSAGE_UNDO = "Last<seq2seq4repair_space>command<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>undone.<seq2seq4repair_space>\n" ; private static final String MESSAGE_INVALID_COMMAND = "Invalid<seq2seq4repair_space>command.<seq2seq4repair_space>\n" ; private static final String MESSAGE_NO_UNDO = "Already<seq2seq4repair_space>at<seq2seq4repair_space>oldest<seq2seq4repair_space>change,<seq2seq4repair_space>unable<seq2seq4repair_space>to<seq2seq4repair_space>undo.<seq2seq4repair_space>\n" ; private static final String HELP_ADD = "add<seq2seq4repair_space><arguments>" ; private static final String HELP_EDIT = "edit<seq2seq4repair_space><index><seq2seq4repair_space><desc//dead><seq2seq4repair_space><arguments>" ; private static final String HELP_DELETE = "delete<seq2seq4repair_space><index>" ; private static final String HELP_COMPLETE = "complete<seq2seq4repair_space><index>" ; private static final String HELP_INCOMPLETE = "incomplete<seq2seq4repair_space><index>" ; private static final String HELP_UNDO = "undo" ; private static final String HELP_SET_SAVE_LOCATION = "set<seq2seq4repair_space><directory>" ; private static final String HELP_SEARCH = "search<seq2seq4repair_space><keyworrd//date>" ; private static final String HELP_EXIT = "exit" ; public static Controller getInstance ( ) { } private Controller ( ) { } public void onloadDisplay ( ) { } public String getWelcomeMessage ( ) { } public String executeCommand ( String input ) { } public boolean isTimeToExit ( ) { } private String setSaveFileDirectory ( String input ) { } private ArrayList < Task > getIncompleteTasks ( ArrayList < Task > allTasks ) { } private List < Task > getCompletedTasks ( ArrayList < Task > allTasks ) { } public void setDisplay ( Display display ) { } public void setStage ( Stage stage ) { } private String addTask ( String input ) { } private String deleteTask ( String input ) { } private String editTask ( String input ) { } private String completeTask ( String input ) { try { int index = ( Integer . parseInt ( input . trim ( ) ) ) - 1 ; Task task = displayedTasks . get ( index ) ; if ( task . isCompleted ( ) ) { return String . format ( Controller . MESSAGE_COMPLETE_FAILED , task . getDescription ( ) ) ; } <START_BUG> task . markAsComplete ( ) ; <END_BUG> updateStorageWithAllTasks ( ) ; return String . format ( Controller . MESSAGE_COMPLETE , task . getDescription ( ) ) ; } catch ( NumberFormatException | IndexOutOfBoundsException e ) { return Controller . MESSAGE_INVALID_COMMAND ; } } private String incompleteTask ( String input ) { } private String undo ( ) { } private void search ( String input ) { } private void displayTask ( String input ) { } private String invalid ( ) { } private String exit ( ) { } private void updateDisplayWithDefault ( ) { } private void updateDisplayWithCompleted ( ) { } private void updateDisplaySearch ( ) { } private void sortAllTasks ( ) { } private void sortSearchedTasks ( ) { } private void updateStorageWithAllTasks ( ) { } private void updateState ( ) { } private ArrayList < Task > cloneState ( ArrayList < Task > input ) { } private ObservableList < Task > cloneState ( ObservableList < Task > input ) { } public List < Task > getIncompleteTasksPublic ( ) { } public List < Task > getCompleteTasksPublic ( ) { } public void clear ( ) { } }

Fix:
task . markAsCompleted ( ) ;