[Demonstration 1]

[Buggy Method]
private Account getSelectedAccount() {
    if (list.isSelectionEmpty() == false) {
        for (Account account : user.getAccounts()) {
            if (account.getAccountNumber() == (Integer) list.getSelectedValue()) {
                return account;
            }
        }
    }
    return null;
}

[Buggy Hunk]
for(Account account : user.getAccounts()) {

[Patch]
for(Account account : accounts) {

[Demonstration 2]

[Buggy Method]
private void calculateHoursWork(final WorkDay workDay) throws ErrorEvent {
    long workLong = 0;
    if (workDay.getEnd() != null) {
        workLong = workDay.getEnd().getTime() - workDay.getStart().getTime();
        Pauses pauses = workDay.getPauses();
        for (Pause pause : pauses) {
            long pauseLong = pause.getEnd().getTime() - pause.getStart().getTime();
            workLong -= pauseLong;
        }
    } else if (workDay == timeSheet.getLastWorkDay()) {
        workLong = new Date().getTime() - workDay.getStart().getTime();
        Pauses pauses = workDay.getPauses();
        for (Pause pause : pauses) {
            long pauseLong = new Date().getTime() - pause.getStart().getTime();
            workLong -= pauseLong;
        }
    }
    workDay.setHoursWork(workLong / CONVERT_MILLISECONDS_TO_HOURS);
}

[Buggy Hunk]
long pauseLong = new Date().getTime() - pause.getStart().getTime();

[Patch]
long pauseLong = pause.getEnd().getTime() - pause.getStart().getTime();

[Demonstration 3]

[Buggy Method]
private void storeDataToFile(byte[] data) throws IOException {
    Path path = Paths.get(this.props.getDataPersistenceFileDirectory(), ModelUtils.translateURNtoFolderPath(this.urn));
    Path file = Paths.get(path.toString(), ModelUtils.DATA_FILE_NAME);
    if (data == null) {
        // We assume that if the value is set to null, we should delete also the corresponding file
        Files.deleteIfExists(file);
    } else {
        if (Files.notExists(path)) {
            Files.createDirectories(path);
        }
        Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE);
    }
}

[Buggy Hunk]
Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE);

[Patch]
Files.write(file, data, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);