Buggy code:
public class CommandParser implements Parser { private static final String MESSAGE_INVALID_COMMAND = "Invalid<seq2seq4repair_space>Command" ; private static final String [ ] KEYWORDS_DATETIME_SEPARATOR = new String [ ] { "from" , "on" , "between" , "by" , "in" , "at" , "on" } ; private static final String [ ] COMMAND_KEYWORD_ADD = new String [ ] { "add" , "create" , "new" , "ins" , "insert" , "put" } ; private static final String [ ] COMMAND_KEYWORD_UPDATE = new String [ ] { "update" , "change" , "modify" , "edit" , "alter" } ; private static final String [ ] COMMAND_KEYWORD_DELETE = new String [ ] { "delete" , "clear" , "remove" } ; private static final String [ ] COMMAND_KEYWORD_VIEW_AND_SEARCH = new String [ ] { "search" , "find" , "look" , "display" , "show" , "open" , "view" , "list" } ; private static final String [ ] COMMAND_KEYWORD_UNDO = new String [ ] { "undo" , "revert" } ; private static final String [ ] COMMAND_KEYWORD_EXIT = new String [ ] { "exit" , "quit" , "close" } ; private static final String [ ] VIEW_KEYWORDS_ALL = new String [ ] { "" , "all" , "everything" } ; private static final String [ ] VIEW_KEYWORDS_UPCOMING = new String [ ] { "upcoming" , "incomplete" , "undone" , "todo" } ; private static final String [ ] VIEW_KEYWORDS_COMPLETED = new String [ ] { "completed" , "complete" , "done" } ; private static final String [ ] VIEW_KEYWORDS_OVERDUE = new String [ ] { "overdue" , "due" , "urgent" , "late" } ; private static final String [ ] SEARCH_RELATIVITY_BEFORE = new String [ ] { "before" } ; private static final String [ ] SEARCH_RELATIVITY_AFTER = new String [ ] { "after" } ; private static final String [ ] SEARCH_RELATIVITY_EXACT = new String [ ] { "on" } ; private static final String [ ] SEARCH_RELATIVITY_SPECIFIED = new String [ ] { "between" , "from" } ; private static final String [ ] SEARCH_RELATIVITY_RELATIVE = new String [ ] { "this" , "rest<seq2seq4repair_space>of" , "in" } ; private static final LocalDateTime MIN_DATETIME = LocalDateTime . MIN ; private static final LocalDateTime MAX_DATETIME = LocalDateTime . MAX ; private static final int NUM_START_END_DATETIME = 2 ; private static final int START_DATETIME = 0 ; private static final int END_DATETIME = 1 ; private enum RelativeType { BEFORE , AFTER , EXACT , SPECIFIED , RELATIVE , NONE ; } private com . joestelmach . natty . Parser _natty ; private Logger _logger ; private HashMap < String , ViewType > dictViewTypes ; private HashMap < String , CommandParser . RelativeType > dictRelativeTypes ; public CommandParser ( ) { } private void initializeDictionaries ( ) { } public void parse ( String input ) { } private CommandParser . RelativeType getRelativeType ( String key ) { } private CommandType getCommandType ( String key ) throws InvalidCommandException { } private void executeCommandType ( CommandType cmd , String command ) throws InvalidCommandException { } private void doAdd ( String command ) { } private void doUpdate ( String command ) { } private void doDelete ( String command ) { } private void doView ( String command ) { } private void doUndo ( String command ) { } private void doExit ( ) { } private static LocalDateTime [ ] getStartAndEndDateTime ( List < Date > dates ) { LocalDateTime [ ] startAndEndDateTime = new LocalDateTime [ CommandParser . NUM_START_END_DATETIME ] ; if ( ( dates . size ( ) ) > 1 ) { Date datetime1 = dates . get ( 0 ) ; Date datetime2 = dates . get ( 1 ) ; LocalDateTime ldt1 = CommandParser . convertDateToLocalDateTime ( datetime1 ) ; <START_BUG> LocalDateTime ldt2 = CommandParser . convertDateToLocalDateTime ( datetime1 ) ; <END_BUG> if ( ldt1 . isAfter ( ldt2 ) ) { startAndEndDateTime [ CommandParser . START_DATETIME ] = ldt2 ; startAndEndDateTime [ CommandParser . END_DATETIME ] = ldt1 ; } else { startAndEndDateTime [ CommandParser . START_DATETIME ] = ldt1 ; startAndEndDateTime [ CommandParser . END_DATETIME ] = ldt2 ; } } else if ( ( dates . size ( ) ) == 1 ) { Date datetime1 = dates . get ( 0 ) ; LocalDateTime ldt1 = CommandParser . convertDateToLocalDateTime ( datetime1 ) ; startAndEndDateTime [ CommandParser . START_DATETIME ] = ldt1 ; startAndEndDateTime [ CommandParser . END_DATETIME ] = ldt1 ; } return startAndEndDateTime ; } private static boolean hasKeyword ( String needle , String [ ] haystack ) { } private static String getCommandKeyword ( String command ) { } private static String getCommandParameters ( String command ) { } private static String [ ] splitStringWithWhitespace ( String command ) { } private static LocalDateTime convertDateToLocalDateTime ( Date date ) { } }

Fix:
LocalDateTime ldt2 = CommandParser . convertDateToLocalDateTime ( datetime2 ) ;