[Demonstration 1]

[Buggy Method]
public void saveFile(String name) {
    try {
        File newFile = new File(name);
        FileWriter fw = new FileWriter(newFile);
        BufferedWriter bw = new BufferedWriter(fw);
        for (String s : lines) {
            bw.write(s + "\n");
        }
        bw.flush();
        fw.close();
    } catch (Exception ex) {
        System.out.println("Couldn't save file.\nPlease try again.");
    }
}

[Buggy Hunk]
public void saveFile(String name){

[Patch]
void saveFile(String name){

[Demonstration 2]

[Buggy Method]
@Override
public void execute() {
    String htmlText = this.editor.getBuffer();
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Save HTML");
    fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("HTML", "*.html"));
    File file = fileChooser.showSaveDialog(this.editor.getStage());
    if (file != null) {
        try {
            try (FileWriter fileWriter = new FileWriter(file)) {
                fileWriter.write(htmlText);
            }
            Tab thisTab = this.editor.tabPane.getSelectionModel().getSelectedItem();
            thisTab.setText(file.getName());
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    }
}

[Buggy Hunk]
Tab thisTab = this.editor.tabPane.getSelectionModel().getSelectedItem();

[Patch]
Tab thisTab = this.editor.getTabPane().getSelectionModel().getSelectedItem();

[Demonstration 3]

[Buggy Method]
void retryWithBackoff(final Map<TaskId, Set<TopicPartition>> tasksToBeCreated, final long start) {
    long backoffTimeMs = 50L;
    final Set<TaskId> retryingTasks = new HashSet<>();
    long nextLoggingTime = System.currentTimeMillis() + 10000;
    while (true) {
        final Iterator<Map.Entry<TaskId, Set<TopicPartition>>> it = tasksToBeCreated.entrySet().iterator();
        while (it.hasNext()) {
            final Map.Entry<TaskId, Set<TopicPartition>> newTaskAndPartitions = it.next();
            final TaskId taskId = newTaskAndPartitions.getKey();
            final Set<TopicPartition> partitions = newTaskAndPartitions.getValue();
            try {
                createTask(taskId, partitions);
                it.remove();
                backoffTimeMs = 50L;
                if (retryingTasks.remove(taskId) && log.isWarnEnabled()) {
                    log.info("{} Created task {}", logPrefix, taskId);
                }
            } catch (final LockException e) {
                // ignore and retry
                if (!retryingTasks.contains(taskId)) {
                    log.warn("{} Could not create task {}. Will retry. {}", logPrefix, taskId, e);
                    retryingTasks.add(taskId);
                }
            }
        }
        if (tasksToBeCreated.isEmpty() || time.milliseconds() - start > rebalanceTimeoutMs) {
            break;
        }
        try {
            Thread.sleep(backoffTimeMs);
            backoffTimeMs <<= 1;
            backoffTimeMs = Math.min(backoffTimeMs, maxBackoffTimeMs);
        } catch (final InterruptedException e) {
            // ignore
        }
        if (System.currentTimeMillis() > nextLoggingTime) {
            nextLoggingTime += 10000;
            log.warn("{} Still retrying to create tasks: {}", logPrefix, retryingTasks);
        }
    }
}

[Buggy Hunk]
backoffTimeMs = Math.min(backoffTimeMs, maxBackoffTimeMs);

[Patch]
backoffTimeMs = Math.min(backoffTimeMs, MAX_BACKOFF_TIME_MS);