[Demonstration 1]

[Buggy Method]
public byte[] read(int bytes) {
    return Serial.serialGetBytes(arg0, arg1);
}

[Buggy Hunk]
return Serial.serialGetBytes(arg0, arg1);

[Patch]
return Serial.serialGetBytes(fileDescriptor, lineLength);

[Demonstration 2]

[Buggy Method]
public Request read(InputStream source) {
    Scanner scanner = createLineScanner(source);
    String command;
    try {
        command = scanner.next();
    } catch (NoSuchElementException ex) {
        return null;
    }
    expect(scanner, AbstractMessage.COMMAND_DELIMITER);
    try {
        RequestType type = RequestType.parse(command);
        switch(type) {
            case LOGIN:
            case VIRTUAL_LOGIN:
            case NEW_VIRTUAL_LOGIN:
            case STAFF_LOGIN:
                return readLoginRequest(scanner, type);
            case LOGOUT:
            case VIRTUAL_LOGOUT:
                return readLogoutRequest(scanner, type);
            case ACCOUNT:
            case VIRTUAL_ACCOUNT:
            case NEW_VIRTUAL_ACCOUNT:
                return readAccountRequest(scanner, type);
            case NOTES:
                return readNotesRequest(scanner);
            case FACILITY_NAME:
            case FACILITY_COUNT:
            case FACILITY_LIST:
            case USE_PROJECT:
            case USE_TIMER:
            case USE_FULL_SCREEN:
            case USE_VIRTUAL:
            case SYSTEM_PASSWORD:
            case NET_DRIVE:
                return readQuery(scanner, type);
            default:
                throw new AssertionError("not implemented");
        }
    } catch (IllegalArgumentException ex) {
        throw new MessageSyntaxException(ex.getMessage(), ex);
    }
}

[Buggy Hunk]
Scanner scanner = createLineScanner(source);

[Patch]
Scanner scanner = createLineScanner(new BufferedReader(new InputStreamReader(source)));

[Demonstration 3]

[Buggy Method]
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    KeyChain other = (KeyChain) obj;
    if (keys == null) {
        if (other.keys != null) {
            return false;
        }
    } else {
        if (this.keys.size() != other.keys.size()) {
            return false;
        }
        for (int i = 0; i < this.keys.size(); i++) {
            if (this.keys.get(i) != other.keys.get(i)) {
                return false;
            }
        }
    }
    return true;
}

[Buggy Hunk]
if (this.keys.get(i) != other.keys.get(i)) {

[Patch]
if (!this.keys.get(i).equals(other.keys.get(i))) {