[Demonstration 1]

[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 2]

[Buggy Method]
public static int[] twoSum(int[] nums, int target) {
    int length = nums.length;
    int[] res = new int[2];
    HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(length);
    map.put(nums[0], 0);
    for (int i = 1; i < length; i++) {
        int geted = nums[i];
        boolean rep = (target - nums[i]) == geted;
        if (rep && map.containsKey(geted)) {
            res[0] = map.get(geted);
            res[1] = i;
            System.out.println(geted + "[[" + i);
            return res;
        } else
            map.put(geted, i);
        System.out.println(nums[i] + "--" + map.get(nums[i]));
    }
    for (int i = 0; i < length; i++) {
        int geted = nums[i];
        if ((target - geted) == nums[i])
            map.remove(geted);
        int wanted = target - geted;
        System.out.println(i + "==" + nums[i] + "==" + wanted);
        if (map.containsKey(wanted)) {
            res[0] = i;
            res[1] = map.get(wanted);
            System.out.println(wanted + "->" + i);
            return res;
        }
    }
    return res;
}

[Buggy Hunk]
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(length);

[Patch]
HashMap<Integer, Integer> map = new HashMap<>(length);

[Demonstration 3]

[Buggy Method]
public static BooleanMatrix readSparseWithMissing(String location) throws FileNotFoundException, IOException {
    BufferedReader bur = new BufferedReader(new FileReader(new File(location)));
    String line = bur.readLine();
    HashMap<Integer, Integer> mappingPos = new HashMap<Integer, Integer>();
    HashMap<Integer, Integer> mappingNeg = new HashMap<Integer, Integer>();
    int sizeX = 0;
    int sizeY = 0;
    while (line != null) {
        String[] linespl = line.split(" ");
        int x = Integer.parseInt(linespl[0]);
        int y = Integer.parseInt(linespl[1]);
        if (linespl[2].equals("t")) {
            mappingPos.put(x, y);
        }
        if (linespl[2].equals("n")) {
            mappingNeg.put(x, y);
        }
        if (x > sizeX) {
            sizeX = x;
        }
        if (y > sizeY) {
            sizeY = y;
        }
        line = bur.readLine();
    }
    byte[][] mat = new byte[sizeX][sizeY];
    for (int i = 0; i < mat.length; i++) {
        for (int j = 0; j < mat.length; j++) {
            mat[i][j] = BooleanMatrix.UNKNOWN;
        }
    }
    for (Integer key : mappingPos.keySet()) {
        mat[key][mappingPos.get(key)] = BooleanMatrix.TRUE;
    }
    for (Integer key : mappingNeg.keySet()) {
        mat[key][mappingNeg.get(key)] = BooleanMatrix.FALSE;
    }
    return new BooleanMatrix(mat);
}

[Buggy Hunk]
byte[][] mat = new byte[sizeX][sizeY];

[Patch]
byte[][] mat = new byte[sizeX+1][sizeY+1];