[Demonstration 1]

[Buggy Method]
public String formatAll() {
    final StringBuilder message = new StringBuilder(headers());
    message.append("<html><body>");
    message.append(makeUptime(startTime));
    if (!errorAll.isEmpty()) {
        message.append(makeTitle("ERRORS"));
        message.append(makeContent(errorAll));
    }
    if (!movedAll.isEmpty()) {
        message.append(makeTitle("MOVED"));
        message.append(makeContent(movedAll));
    }
    if (!duplicateAll.isEmpty()) {
        message.append(makeTitle("DELETED DUPLICATES"));
        message.append(makeContent(duplicateAll));
    }
    if (!downloadedAll.isEmpty()) {
        message.append(makeTitle("DOWNLOADED"));
        message.append(makeContent(downloadedAll));
    }
    if (!seenAll.isEmpty()) {
        message.append(makeTitle("SEEN"));
        message.append(makeContent(seenAll));
    }
    message.append("</body></html>");
    return message.toString();
}

[Buggy Hunk]
final StringBuilder message = new StringBuilder(headers());

[Patch]
final StringBuilder message = new StringBuilder(HEADERS);

[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]
private void embedDependency(Artifact dependency, StringBuffer includeResource, StringBuffer bundleClassPath, StringBuffer embeddedArtifacts) {
    File sourceFile = dependency.getFile();
    if (null != sourceFile && sourceFile.exists()) {
        String embedDirectory = m_embedDirectory;
        if ("".equals(embedDirectory) || ".".equals(embedDirectory)) {
            embedDirectory = null;
        }
        if (false == Boolean.valueOf(m_embedStripGroup).booleanValue()) {
            embedDirectory = new File(embedDirectory, dependency.getGroupId()).getPath();
        }
        StringBuffer targetFileName = new StringBuffer();
        targetFileName.append(dependency.getArtifactId());
        if (false == Boolean.valueOf(m_embedStripVersion).booleanValue()) {
            targetFileName.append('-').append(dependency.getVersion());
            if (StringUtils.isNotEmpty(dependency.getClassifier())) {
                targetFileName.append('-').append(dependency.getClassifier());
            }
        }
        String extension = dependency.getArtifactHandler().getExtension();
        if (StringUtils.isNotEmpty(extension)) {
            targetFileName.append('.').append(extension);
        }
        File targetFile = new File(embedDirectory, targetFileName.toString());
        String targetFilePath = targetFile.getPath();
        // replace windows backslash with a slash
        if (File.separatorChar != '/') {
            targetFilePath = targetFilePath.replace(File.separatorChar, '/');
        }
        if (includeResource.length() > 0) {
            includeResource.append(',');
        }
        includeResource.append(targetFilePath);
        includeResource.append('=');
        includeResource.append(sourceFile);
        if (bundleClassPath.length() > 0) {
            bundleClassPath.append(',');
        }
        bundleClassPath.append(targetFilePath);
        if (embeddedArtifacts.length() > 0) {
            embeddedArtifacts.append(',');
        }
        embeddedArtifacts.append(targetFilePath).append(';');
        embeddedArtifacts.append("g=\"").append(dependency.getGroupId()).append('"');
        embeddedArtifacts.append(";a=\"").append(dependency.getArtifactId()).append('"');
        embeddedArtifacts.append(";v=\"").append(dependency.getBaseVersion()).append('"');
        if (StringUtils.isNotEmpty(dependency.getClassifier())) {
            embeddedArtifacts.append(";c=\"").append(dependency.getClassifier()).append('"');
        }
    }
}

[Buggy Hunk]
targetFileName.append( '-' ).append( dependency.getVersion() );

[Patch]
targetFileName.append( '-' ).append( dependency.getBaseVersion() );