[Demonstration 1]

[Buggy Method]
private void acceptClose(String tag, int finSeq) throws IOException {
    Thread thread = new Thread() {

        @Override
        public void run() {
            TTPConnection conn = connections.get(tag);
            TTPSegment finack = packSegment(conn, TTPSegment.Type.FIN_ACK, finSeq, null);
            try {
                sendSegment(conn, finack);
            } catch (IOException e) {
            }
            conn.setLastAcked(finSeq);
            // wait to receive ACK of FIN_ACK
            try {
                while (conn.hasUnacked() && conn.firstUnacked() <= finack.getSeqNum()) ;
            } catch (NoSuchElementException e) {
            }
            connections.remove(conn.getTag());
            conn.close();
        }
    };
    thread.start();
}

[Buggy Hunk]
private void acceptClose(String tag, int finSeq) throws IOException {

[Patch]
private void acceptClose(final String tag, final int finSeq) throws IOException {

[Demonstration 2]

[Buggy Method]
public static String collapseArgsWithoutCityName(String[] args, int start, String cityName, String delimiter) {
    int adjustment = cityName.split(" ").length;
    if (!String.join(" ", args).contains(cityName))
        adjustment = 0;
    StringBuilder joinedArgs = new StringBuilder(args[start]);
    for (int i = start + 1; i < args.length - adjustment; i++) {
        joinedArgs.append(delimiter + args[i]);
    }
    return joinedArgs.toString();
}

[Buggy Hunk]
if (!String.join(" ", args).contains(cityName)) adjustment = 0;

[Patch]
if (stringJoin(" ", args).contains(cityName)) adjustment = 0;

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) {
    int port = 6666;
    int maxThreads = 10;
    if (args != null && args.length > 0) {
        port = Integer.parseInt(args[1]);
    }
    if (args.length > 1) {
        maxThreads = Integer.parseInt(args[2]);
    }
    final Protocol protocol = new Protocol(new Protocol.SimpleParser(), new Protocol.SimpleComposer());
    final Authenticator authenticator = new UsernameAuthenticator();
    final Authorization<String, String> authorizer = new Authorization<>();
    final Interpreter interpreter = setupInterpreter(authorizer);
    interpreter.registerFn("register", new Interpreter.Function() {

        public String apply(String[] args) {
            try {
                String role = args[1];
                if (role.equals("user"))
                    args[1] = ROLE_USER;
                else if (role.equals("admin"))
                    args[1] = ROLE_ADMIN;
                authenticator.register(args);
                return "registered user " + args[0] + " as " + role;
            } catch (Authenticator.AuthenticationException e) {
                return e.getMessage();
            }
        }

        public int minArgs() {
            return 2;
        }

        public int maxArgs() {
            return 2;
        }
    });
    authorizer.setPermissionFor(ROLE_ADMIN, "register");
    try {
        authenticator.register("admin", ROLE_ADMIN);
        authorizer.setParentRole(ROLE_USER, ROLE_ADMIN);
    } catch (Authenticator.AuthenticationException e) {
    }
    _server = threadServer ? new MultiThreadServer(port, maxThreads, protocol, interpreter, authenticator, authorizer) : new Server(port, protocol, interpreter, authenticator, authorizer);
    _broadcastServer = new BroadcastServer(9999, _server);
    Runtime.getRuntime().addShutdownHook(shutdownHook);
    _broadcastServer.start();
    _server.start();
    while (_server.isAlive()) {
        try {
            _server.join();
        } catch (InterruptedException e) {
        }
        try {
            _broadcastServer.join();
        } catch (InterruptedException e) {
        }
    }
}

[Buggy Hunk]
final Protocol protocol = new Protocol(new Protocol.SimpleParser(), new Protocol.SimpleComposer());

[Patch]
final Protocol<FunArgsPair> protocol = new Protocol(new Protocol.SimpleParser(), new Protocol.SimpleComposer());