[Demonstration 1]

[Buggy Method]
private synchronized ActionResult handleScanResult(List<ClientDevice> list) {
    if (list == null)
        return ActionResult.FAILURE;
    ClientDevice client;
    for (final ClientDevice device : list) {
        client = listAction(searchCommand, device);
        if (client != null) {
            if (client.isReachable() != device.isReachable()) {
                // update reachable status
                client.setReachable(device.isReachable());
                if (device.isReachable()) {
                    // previously connected client has joined
                    client.setIpAddr(device.getIpAddr());
                    if (serverListener != null)
                        Utility.postOnMainThread(new Runnable() {

                            @Override
                            public void run() {
                                serverListener.onClientJoined(device);
                            }
                        });
                } else {
                    // client has left
                    if (serverListener != null)
                        Utility.postOnMainThread(new Runnable() {

                            @Override
                            public void run() {
                                serverListener.onClientLeft(device);
                            }
                        });
                }
            }
        } else {
            // add currently connected device to the list
            listAction(addCommand, device);
            if (serverListener != null)
                Utility.postOnMainThread(new Runnable() {

                    @Override
                    public void run() {
                        serverListener.onClientJoined(device);
                    }
                });
        }
    }
    return ActionResult.SUCCESS;
}

[Buggy Hunk]
private synchronized ActionResult handleScanResult(List<ClientDevice> list) {

[Patch]
private ActionResult handleScanResult(List<ClientDevice> list) {

[Demonstration 2]

[Buggy Method]
@Override
public void onBluetoothConnectingToDevice(BluetoothDevice device) {
    getGui().showMessage(mContext.getString(R.string.connecting_to_bluetooth_device, device.getName()), Snackbar.LENGTH_INDEFINITE);
}

[Buggy Hunk]
public void onBluetoothConnectingToDevice(BluetoothDevice device) {

[Patch]
public void onBluetoothConnectingToDevice(@NonNull BluetoothDevice device) {

[Demonstration 3]

[Buggy Method]
@Override
public void disconnect() {
    socket.close();
    if (heartbeatTimer != null) {
        heartbeatTimer.cancel();
        heartbeatTimer.purge();
        heartbeatTimer = null;
    }
    if (outboxTimer != null) {
        outboxTimer.cancel();
        outboxTimer.purge();
        outboxTimer = null;
    }
    if (idleTimeoutTimer != null) {
        idleTimeoutTimer.cancel();
        idleTimeoutTimer.purge();
        idleTimeoutTimer = null;
    }
}

[Buggy Hunk]
public void disconnect() {

[Patch]
public synchronized void disconnect() {