[Demonstration 1]

[Buggy Method]
@Override
public void render(FontRenderer fontRenderer, int currenty, Object[] screenData, float factor) {
    GL11.glDisable(GL11.GL_LIGHTING);
    int xoffset;
    if (!line.isEmpty()) {
        fontRenderer.drawString(line, 7, currenty + 2, color);
        xoffset = 7 + 80;
    } else {
        xoffset = 7 + 5;
    }
    boolean act = false;
    if (toggle) {
        if (screenData != null && screenData.length >= 1) {
            act = ((Integer) screenData[0]) > 0;
        }
    } else {
        act = activated;
    }
    RenderHelper.drawBeveledBox(xoffset - 5, currenty, 130 - 7, currenty + 12, act ? 0xff333333 : 0xffeeeeee, act ? 0xffeeeeee : 0xff333333, 0xff666666);
    fontRenderer.drawString(fontRenderer.trimStringToWidth(button, 130 - 7 - xoffset), xoffset + (act ? 1 : 0), currenty + 2 + (act ? 1 : 0), buttonColor);
}

[Buggy Hunk]
if (screenData != null && screenData.length >= 1) {

[Patch]
if (screenData != null && screenData.length >= 1 && screenData[0] instanceof Integer) {

[Demonstration 2]

[Buggy Method]
public Object react(Action action) throws Exception {
    String query = action.getQuery();
    if (query == null || query.length() == 0) {
        return action.execute();
    }
    String charset = action.getQueryEncodeCharset();
    String[] pairs = query.split("&+");
    Map<String, String[]> map = new HashMap<String, String[]>();
    for (String pair : pairs) {
        String[] keyvalue = pair.split("=+");
        String key = keyvalue[0];
        String value = keyvalue.length > 1 ? keyvalue[1] : "";
        if (map.containsKey(key) == false) {
            map.put(key, new String[0]);
        }
        String[] values = map.get(key);
        values = Utils.copyOf(values, values.length + 1);
        values[values.length - 1] = value;
        map.put(key, values);
    }
    List<Parameter> parameters = action.getParameters().all(Position.QUERY);
    for (Parameter parameter : parameters) {
        if (parameter.getValue() != null) {
            continue;
        }
        try {
            boolean decoded = parameter.isCoding() == false || (parameter.isCoding() && parameter.isDecoded());
            Object value = queryConversionProvider.convert(parameter.getName(), parameter.getType(), decoded, charset, map);
            parameter.setValue(value);
        } catch (IncompatibleConversionException e) {
            throw new JestfulIOException(e);
        } catch (ConversionException e) {
            continue;
        }
    }
    return action.execute();
}

[Buggy Hunk]
String key = keyvalue[0];

[Patch]
String key = URLDecoder.decode(keyvalue[0], charset);

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