[Demonstration 1]

[Buggy Method]
public BookmarkReader filterOrphansIterative(int userLevel, int resLevel, int tagLevel) {
    HashSet<Integer> userIDs = new HashSet<Integer>();
    for (int i = 0; i < this.reader.getUsers().size(); i++) {
        int count = this.reader.getUserCounts().get(i);
        if (count >= userLevel) {
            userIDs.add(i);
        }
    }
    System.out.println("User IDs determined ...");
    HashSet<Integer> resIDs = new HashSet<Integer>();
    for (int i = 0; i < this.reader.getResources().size(); i++) {
        int count = this.reader.getResourceCounts().get(i);
        if (count >= resLevel) {
            resIDs.add(i);
        }
    }
    System.out.println("Res IDs determined ...");
    HashSet<Integer> tagIDs = new HashSet<Integer>();
    if (tagLevel > 0) {
        for (int i = 0; i < this.reader.getTags().size(); i++) {
            int count = this.reader.getTagCounts().get(i);
            if (count >= tagLevel) {
                tagIDs.add(i);
            }
        }
        System.out.println("Tag IDs determined ...");
    }
    System.out.println("Start removing ...");
    ArrayList<Bookmark> keepData = new ArrayList<Bookmark>();
    for (Bookmark data : this.reader.getBookmarks()) {
        int resID = data.getResourceID();
        int userID = data.getUserID();
        if (resIDs.contains(resID) && userIDs.contains(userID)) {
            if (tagLevel > 0) {
                ArrayList<Integer> tags = new ArrayList<Integer>();
                for (Integer tag : data.getTags()) {
                    if (tagIDs.contains(tag)) {
                        tags.add(tag);
                    }
                }
                if (tags.size() > 0) {
                    data.setTags(tags);
                    keepData.add(data);
                }
            } else {
                keepData.add(data);
            }
        }
    }
    System.out.println("Kept lines: " + keepData.size());
    this.reader.setTestLines(keepData);
    return this.reader;
}

[Buggy Hunk]
this.reader.setTestLines(keepData);

[Patch]
this.reader.setBookmarks(keepData);

[Demonstration 2]

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

[Demonstration 3]

[Buggy Method]
private BugSummary handleBugSummary() {
    BugSummary summary = new BugSummary();
    try {
        while (reader.hasNext()) {
            if (reader.next() == XMLEvent.START_ELEMENT) {
                if (reader.getLocalName().equals(Constants.BUG_CATEGORY)) {
                    summary.add(handleBugCategory());
                }
            } else {
                if (isEndElement(Constants.BUG_SUMMARY)) {
                    break;
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return summary;
}

[Buggy Hunk]
if (reader.getLocalName().equals(Constants.BUG_CATEGORY)) {

[Patch]
if (Constants.BUG_CATEGORY.equals(reader.getLocalName())) {