[Demonstration 1]

[Buggy Method]
public void createOrReopenIssue(String projectName) throws Exception {
    String issueTitle = bugTrackerSettings.getIssueTitle(projectName);
    Optional<String> issueKeyOpt = getIssueKey(Pattern.compile(projectName, Pattern.CASE_INSENSITIVE));
    CloseableHttpResponse httpResponse = null;
    try {
        if (issueKeyOpt.isPresent()) {
            String issueKey = issueKeyOpt.get();
            Optional<String> transitionKeyOpt = getIssueTransition(issueKey, Pattern.compile(bugTrackerSettings.getTransitionName(), Pattern.CASE_INSENSITIVE));
            if (!transitionKeyOpt.isPresent()) {
                String errorMsg = String.format("\"%s\" transition not found. Ignore this error if the work item \"%s\" is already opened.", bugTrackerSettings.getTransitionName(), issueKey);
                throw new Exception(errorMsg);
            }
            httpResponse = updateStatus(issueKey, transitionKeyOpt.get());
            handleHttpResponse(httpResponse, HttpStatus.SC_NO_CONTENT, "Failed to transition issue %s-\"%s\" to \"%s\" state.", issueKey, issueTitle, bugTrackerSettings.getTransitionName());
        } else {
            httpResponse = createIssue(bugTrackerSettings.getProjectKey(), bugTrackerSettings.getIssueTitle(projectName), bugTrackerSettings.getIssueType(), bugTrackerSettings.getIssueLabel());
            handleHttpResponse(httpResponse, HttpStatus.SC_CREATED, "Failed to create %s with \"%s\" title.", issueTitle);
        }
    } finally {
        if (httpResponse != null) {
            EntityUtils.consume(httpResponse.getEntity());
            final boolean swallowIoException = true;
            Closeables.close(httpResponse, swallowIoException);
        }
    }
}

[Buggy Hunk]
handleHttpResponse(httpResponse, HttpStatus.SC_CREATED, "Failed to create %s with \"%s\" title.", issueTitle);

[Patch]
handleHttpResponse(httpResponse, HttpStatus.SC_CREATED, "Failed to create %s with \"%s\" title.", bugTrackerSettings.getIssueType(), issueTitle);

[Demonstration 2]

[Buggy Method]
@Override
public void onSwitchClick(int idx, boolean checked) {
    try {
        addDebugText("onSwitchClick");
        addDebugText("Set idx " + idx + " to " + checked);
        DevicesInfo clickedSwitch = getSwitch(idx);
        if (checked)
            Snackbar.make(coordinatorLayout, getActivity().getString(R.string.switch_on) + ": " + clickedSwitch.getName(), Snackbar.LENGTH_SHORT).show();
        else
            Snackbar.make(coordinatorLayout, getActivity().getString(R.string.switch_off) + ": " + clickedSwitch.getName(), Snackbar.LENGTH_SHORT).show();
        if (clickedSwitch != null) {
            int jsonAction;
            int jsonUrl = Domoticz.Json.Url.Set.SWITCHES;
            if (clickedSwitch.getSwitchTypeVal() == Domoticz.Device.Type.Value.BLINDS || clickedSwitch.getSwitchTypeVal() == Domoticz.Device.Type.Value.BLINDPERCENTAGE) {
                if (checked)
                    jsonAction = Domoticz.Device.Switch.Action.OFF;
                else
                    jsonAction = Domoticz.Device.Switch.Action.ON;
            } else {
                if (checked)
                    jsonAction = Domoticz.Device.Switch.Action.ON;
                else
                    jsonAction = Domoticz.Device.Switch.Action.OFF;
            }
            mDomoticz.setAction(idx, jsonUrl, jsonAction, 0, new setCommandReceiver() {

                @Override
                public void onReceiveResult(String result) {
                    successHandling(result, false);
                    getSwitchesData();
                }

                @Override
                public void onError(Exception error) {
                    errorHandling(error);
                }
            });
        }
    } catch (Exception ex) {
        Log.e(TAG, ex.getMessage());
    }
}

[Buggy Hunk]
if (clickedSwitch != null) {

[Patch]
if (clickedSwitch.getIdx() > 0) {

[Demonstration 3]

[Buggy Method]
@Setup
public void setUp() throws Exception {
    nodes = new ArrayList<>(nodesCount);
    for (int i = 0; i < nodesCount; i++) {
        HekateBootstrap boot = new HekateBootstrap().withNodeName("node" + i).withDefaultCodec(new KryoCodecFactory<>()).withService(new MetricsServiceFactory());
        configure(i, boot);
        Hekate node = boot.join();
        nodes.add(node);
    }
    initialize(nodes);
}

[Buggy Hunk]
public void setUp() throws Exception {

[Patch]
public void setUp() throws HekateFutureException, InterruptedException {