[Demonstration 1]

[Buggy Method]
public synchronized List<T> accessMany(Integer amount, boolean available) {
    List<T> retList = new ArrayList<T>();
    Iterator<Long> iterator = keySet.iterator();
    for (int i = 0; !iterator.hasNext() && i < amount; i++) {
        try {
            Long key = iterator.next();
            T tmp = null;
            if (available)
                tmp = getFromAvailableContainer(key);
            else
                tmp = getFromBusyContainer(key);
            if (tmp != null)
                retList.add(tmp);
            iterator.remove();
        } catch (Exception e) {
            continue;
        }
    }
    return retList;
}

[Buggy Hunk]
Iterator<Long> iterator = keySet.iterator();

[Patch]
Iterator<Long> iterator = keyContainer.iterator();

[Demonstration 2]

[Buggy Method]
private void setAnswer() {
    LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.layout_answer);
    layout.removeAllViews();
    for (int i = 0; i < answer.length(); i++) {
        if (answer.charAt(i) == '\'' || answer.charAt(i) == '-') {
            TextView t = new TextView(getContext());
            t.setText(answer.charAt(i) + "");
            t.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
            t.setGravity(Gravity.CENTER_HORIZONTAL);
            t.setLayoutParams(new LinearLayout.LayoutParams((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, getResources().getDisplayMetrics()), LinearLayout.LayoutParams.WRAP_CONTENT));
            layout.addView(t);
        } else if (answer.charAt(i) == ' ') {
            View v = new View(getContext());
            v.setLayoutParams(new LinearLayout.LayoutParams((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, getResources().getDisplayMetrics()), LinearLayout.LayoutParams.WRAP_CONTENT));
            layout.addView(v);
        } else {
            Button b = new Button(getContext());
            b.setText(answer.charAt(i) + "");
            b.setLayoutParams(new LinearLayout.LayoutParams((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, getResources().getDisplayMetrics()), LinearLayout.LayoutParams.WRAP_CONTENT));
            b.setClickable(false);
            layout.addView(b);
        }
    }
}

[Buggy Hunk]
LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.layout_answer);

[Patch]
FlexboxLayout layout = (FlexboxLayout) getActivity().findViewById(R.id.layout_answer);

[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));