[Demonstration 1]

[Buggy Method]
@Override
public void processInput(String input, DatabaseService databaseService, TransactionService transactionService) {
    String[] commandAndArgs = input.split("\\s+");
    if (commandAndArgs == null) {
        // TODO: throw exception
        System.err.println("commandAndArgs were null. commandAndArgs: " + commandAndArgs + " input: " + input);
    }
    String command = commandAndArgs[0].toLowerCase();
    if (command.equals(HELP)) {
        // TODO: implement help output
        System.out.println("I'm sorry, help menu not yet implemented.");
    } else if (isTransactionCommand(command)) {
        executeTransactionCommand(commandAndArgs, transactionService);
    } else if (isDatabaseCommand(command)) {
        if (transactionService.isTransactionOpen() && isUndoableDatabaseCommand(commandAndArgs)) {
            addUndoCommandToTransaction(commandAndArgs, transactionService);
        }
        executeDatabaseCommand(commandAndArgs, databaseService);
    } else if (command.equals(END)) {
        System.exit(0);
    } else {
        // TODO: throw exception. no matching command was found
        System.err.println(COMMAND_ERROR_MESSAGE);
    }
}

[Buggy Hunk]
String command = commandAndArgs[0].toLowerCase();

[Patch]
String command = getCommand(commandAndArgs);

[Demonstration 2]

[Buggy Method]
private void checkBeforeSendTo(String st) {
    //the string containing the name of the recipient and the message, cleaned.
    String cleanInput = st.substring(2).trim().replaceAll(" +", " ");
    int indexBeforeMessage = cleanInput.indexOf(" ");
    if (-1 != indexBeforeMessage) {
        String recipient = cleanInput.substring(0, indexBeforeMessage);
        if (checkIfExist(recipient)) {
            if (nickname.equals(recipient)) {
                send("You are " + nickname);
            } else {
                String message = cleanInput.substring(indexBeforeMessage + 1);
                try {
                    sendTo(message, nickname, recipient);
                    //the sender must read what he sends
                    send(nickname + " to " + recipient + "> " + message);
                } catch (NullPointerException npe) {
                    System.out.println(npe.getMessage());
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
            }
        } else {
            send("-info- The nickname " + recipient + " doesn't exist!");
        }
    } else {
        send("-info- Please respect the formalism : @ name message");
    }
}

[Buggy Hunk]
String cleanInput = st.substring(2).trim().replaceAll(" +", " ");       //the string containing the name of the recipient and the message, cleaned.

[Patch]
String cleanInput = st.substring(1).trim().replaceAll(" +", " ");       //the string containing the name of the recipient and the message, cleaned.

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) throws SQLException {
    Connection conn = DriverManager.getConnection("jdbc:h2:./main");
    () -> {
    }.start();
    Statement stmt = conn.createStatement();
    stmt.execute("CREATE TABLE id IDENTITY, username VARCHAR, address VARCHAR, email VARCHAR");
}

[Buggy Hunk]
().start();

[Patch]
Server.createWebServer().start();