[Demonstration 1]

[Buggy Method]
public PactDslResponse body(DslPart body) {
    for (String matcherName : body.matchers.keySet()) {
        responseMatchers.put("$.body" + matcherName, body.matchers.get(matcherName));
    }
    responseBody = OptionalBody.body(body.toString());
    if (!responseHeaders.containsKey("Content-Type")) {
        responseHeaders.put("Content-Type", ContentType.APPLICATION_JSON.toString());
    }
    return this;
}

[Buggy Hunk]
responseBody = OptionalBody.body(body.toString());

[Patch]
responseBody = OptionalBody.body(body.getBody().toString());

[Demonstration 2]

[Buggy Method]
private void refreshKarmaCount() {
    if (tag != LeaderboardFragment.DEN_TAG) {
        return;
    }
    ServerRestClient.get("users/", null, new AsyncHttpResponseHandler() {

        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            final JSONArray resArray;
            try {
                resArray = new JSONArray(new String(responseBody));
                for (int idx = 0; idx < resArray.length(); idx++) {
                    JSONObject userObject = resArray.getJSONObject(idx);
                    //TODO Get user ID from device!
                    if (userObject.optString("user_id").equals("temp_test_id")) {
                        int totalLikes = userObject.getInt("total_likes");
                        karmaTextView.setText(Integer.toString(totalLikes));
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            Toast.makeText(mParentFragment.getActivity(), "Failed", Toast.LENGTH_SHORT).show();
            Log.d("Failure", Integer.toString(statusCode));
        }
    });
}

[Buggy Hunk]
if (tag != LeaderboardFragment.DEN_TAG) {

[Patch]
if (!tag.equals(LeaderboardFragment.DEN_TAG)) {

[Demonstration 3]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));