[Demonstration 1]

[Buggy Method]
@Test
public void testListInDetail() throws Exception {
    Optional<? extends AvailabilityZoneApi> availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne");
    if (availabilityZoneApi.isPresent()) {
        FluentIterable<? extends AvailabilityZoneDetails> zones = availabilityZoneApi.get().listInDetail();
        for (AvailabilityZoneDetails zone : zones) {
            assertNotNull(zone.getName());
            assertTrue(zone.getState().isAvailable(), "zone: " + zone.getName() + " is not available.");
            String hostName = zone.getHosts().keySet().iterator().next();
            assertNotNull(hostName, "Expected host name to be not null");
            String hostServiceName = zone.getHosts().get(hostName).keySet().iterator().next();
            assertNotNull(hostServiceName, "Expected host service name to be not null");
            AvailabilityZoneDetails.HostService hostService = zone.getHosts().get(hostName).get(hostServiceName);
            assertTrue(hostService.isAvailable(), "Couldn't find host service availability");
            assertTrue(hostService.isActive(), "Couldn't find host service state");
            assertNotNull(hostService.getUpdated(), "Expected Updated time, but none received ");
        }
    }
}

[Buggy Hunk]
AvailabilityZoneDetails.HostService hostService = zone.getHosts().get(hostName).get(hostServiceName);

[Patch]
HostService hostService = zone.getHosts().get(hostName).get(hostServiceName);

[Demonstration 2]

[Buggy Method]
public DeleteRecordsResult deleteRecords(Map<TopicPartition, Long> partitionsAndOffsets, final DeleteRecordsOptions options) {
    // requests need to be sent to partitions leader nodes so ...
    // ... from the provided map it's needed to create more maps grouping topic/partition per leader
    Map<Node, Map<TopicPartition, Long>> leaders = new HashMap<>();
    for (Map.Entry<TopicPartition, Long> entry : partitionsAndOffsets.entrySet()) {
        Node node = metadata.fetch().leaderFor(entry.getKey());
        if (!leaders.containsKey(node))
            leaders.put(node, new HashMap<TopicPartition, Long>());
        leaders.get(node).put(entry.getKey(), entry.getValue());
    }
    final Map<TopicPartition, KafkaFutureImpl<Long>> futures = new HashMap<>(partitionsAndOffsets.size());
    for (TopicPartition topicPartition : partitionsAndOffsets.keySet()) {
        futures.put(topicPartition, new KafkaFutureImpl<Long>());
    }
    final long now = time.milliseconds();
    for (final Map.Entry<Node, Map<TopicPartition, Long>> entry : leaders.entrySet()) {
        final int brokerId = entry.getKey().id();
        runnable.call(new Call("deleteRecords", calcDeadlineMs(now, options.timeoutMs()), new ConstantNodeIdProvider(brokerId)) {

            @Override
            AbstractRequest.Builder createRequest(int timeoutMs) {
                return new DeleteRecordsRequest.Builder(timeoutMs, entry.getValue());
            }

            @Override
            void handleResponse(AbstractResponse abstractResponse) {
                DeleteRecordsResponse response = (DeleteRecordsResponse) abstractResponse;
                for (Map.Entry<TopicPartition, DeleteRecordsResponse.PartitionResponse> result : response.responses().entrySet()) {
                    KafkaFutureImpl<Long> future = futures.get(result.getKey());
                    if (result.getValue().error != Errors.NONE) {
                        future.complete(result.getValue().lowWatermark);
                    } else {
                        future.completeExceptionally(result.getValue().error.exception());
                    }
                }
            }

            @Override
            void handleFailure(Throwable throwable) {
                completeAllExceptionally(futures.values(), throwable);
            }
        }, now);
    }
    return new DeleteRecordsResult(new HashMap<TopicPartition, KafkaFuture<Long>>(futures));
}

[Buggy Hunk]
if (result.getValue().error != Errors.NONE) {

[Patch]
if (result.getValue().error == Errors.NONE) {

[Demonstration 3]

[Buggy Method]
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    if (event.phase == TickEvent.Phase.END && this.mc.isGamePaused() == false) {
        // Prevent mouse input while recording and controls locked, and always while moving
        if ((State.getRecording() == true && State.getControlsLocked() == true) || State.getMotion() == true) {
            this.mc.setIngameNotInFocus();
        }
        RecordingHandler.getInstance().multishotScheduler();
        // Move the player. Note: the pause key doesn't have an effect if not recording
        if (State.getMotion() == true && (State.getPaused() == false || State.getRecording() == false)) {
            Motion.getMotion().movePlayer(this.mc.thePlayer);
        }
        // Print the queued messages from the screenshot saving thread, if any
        MsThread.printGuiMessages();
    }
}

[Buggy Hunk]
if (State.getMotion() == true && (State.getPaused() == false || State.getRecording() == false))

[Patch]
if (State.getMotion() == true && State.getPaused() == false)