[Demonstration 1]

[Buggy Method]
boolean getBoolean(String propertyName) {
    Objects.requireNonNull(propertyName);
    checkLoaded();
    String value = PROPERTIES.get(propertyName);
    try {
        return Boolean.getBoolean(value);
    } catch (NumberFormatException e) {
        LOG.warn("[{}] could not be parsed as a boolean when requesting [{}].", value, propertyName);
        throw e;
    }
}

[Buggy Hunk]
return Boolean.getBoolean(value);

[Patch]
return Boolean.valueOf(value);

[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]
public Boolean getBoolean(String key, Boolean defaultValue) {
    Object value = get(key);
    if (value instanceof Boolean) {
        return (Boolean) value;
    } else if (value instanceof String) {
        String s = testBoolean(((String) value).trim());
        Boolean b = new Boolean(s);
        put(key, b);
        return b;
    } else if (value == null) {
        if (defaults != null) {
            return defaults.getBoolean(key, defaultValue);
        } else {
            return defaultValue;
        }
    } else {
        throw new ClassCastException('\'' + key + "' doesn't map to a Boolean object");
    }
}

[Buggy Hunk]
Boolean b = new Boolean(s);

[Patch]
Boolean b = Boolean.valueOf(s);