[Demonstration 1]

[Buggy Method]
public JSONArray getCriteriaValue() {
    JSONArray ret = new JSONArray();
    JSONObject criteria = getAllCriteria();
    JSONObject criteriaValue = getAllCriteriaValue();
    if (criteria == null || criteriaValue == null) {
        return null;
    }
    Collection values = criteria.values();
    for (Object value : values) {
        JSONObject val = (JSONObject) value;
        Long parentId = (Long) val.get(RetCode.parent_id);
        if (parentId == null || parentId == 0) {
            if (!val.containsKey(RetCode.data)) {
                val.put(RetCode.data, new JSONArray());
            }
            ret.add(val);
        } else {
            JSONObject parent = (JSONObject) criteria.get(parentId);
            JSONArray parentData = (JSONArray) parent.get(RetCode.data);
            if (parentData == null) {
                parentData = new JSONArray();
                parent.put(RetCode.data, parentData);
            }
            parentData.add(value);
        }
    }
    Collection valuesCriteriaValue = criteriaValue.values();
    for (Object object : valuesCriteriaValue) {
        JSONObject val = (JSONObject) object;
        Long criteriaId = (Long) val.get(RetCode.criteria_id);
        JSONObject criteriaObj = (JSONObject) criteria.get(criteriaId);
        JSONArray data = (JSONArray) criteriaObj.get(RetCode.data);
        if (data == null) {
            data = new JSONArray();
            criteriaObj.put(RetCode.data, data);
        }
        data.add(object);
    }
    return ret;
}

[Buggy Hunk]
if (parentId == null || parentId == 0) {

[Patch]
if (parentId == null || parentId == Noise64.NOISE_0) {

[Demonstration 2]

[Buggy Method]
public void run() {
    JsonArray newMessgaes = fetchMessages();
    if (newMessgaes.size() != 0) {
        allMessages.addAll(newMessgaes);
        for (int i = 0; i < newMessgaes.size(); i++) {
            String chatroom = newMessgaes.get(i).getAsJsonArray().get(2).toString();
            if (callBackMap.get(chatroom) != null)
                callBackMap.get(chatroom).onMessage(new Message(newMessgaes.get(i).getAsJsonArray()));
        }
    }
    //h.postDelayed(this, delay);
}

[Buggy Hunk]
String chatroom = newMessgaes.get(i).getAsJsonArray().get(2).toString();

[Patch]
String chatroom = newMessgaes.get(i).getAsJsonArray().get(2).toString().replace("\"","");

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