[Demonstration 1]

[Buggy Method]
@Override
public Value evaluate(final ValueFactory factory, final Value... args) throws ValueExprEvaluationException {
    String ns = null;
    String name = null;
    final List<String> strings = new ArrayList<>(8);
    for (final Value arg : args) {
        if (arg instanceof URI) {
            final URI uri = (URI) arg;
            final String string = uri.stringValue();
            strings.add("\u0001");
            strings.add(string);
            if (ns == null) {
                ns = uri.getNamespace();
            }
            if (name == null) {
                final char ch = string.charAt(string.length() - 1);
                if (ch != ':' && ch != '/' && ch != '#') {
                    name = uri.getLocalName();
                }
            }
        } else if (arg instanceof BNode) {
            final BNode bnode = (BNode) arg;
            strings.add("\u0002");
            strings.add(bnode.getID());
            if (name == null) {
                name = bnode.getID();
            }
        } else {
            final Literal l = (Literal) arg;
            if (l.getLanguage() != null) {
                strings.add("\u0003");
                strings.add(l.getLanguage());
            } else if (l.getDatatype() != null) {
                strings.add("\u0004");
                strings.add(l.getDatatype().stringValue());
            } else {
                strings.add("\u0005");
            }
            strings.add(l.getLabel());
            if (name == null) {
                name = l.getLabel();
            }
        }
    }
    final Hash hash = Hash.murmur3(strings.toArray(new String[strings.size()]));
    final StringBuilder builder = new StringBuilder();
    builder.append(ns != null ? ns : DEFAULT_NS);
    if (name != null) {
        builder.append(name).append('_');
    }
    builder.append(hash.toString());
    return factory.createURI(builder.toString());
}

[Buggy Hunk]
builder.append(name).append('_');

[Patch]
builder.append(name.replaceAll("\\s+", "_")).append('_');

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