[Demonstration 1]

[Buggy Method]
private void fillSheet(String table, Sheet sheet) {
    Row headerRow = sheet.createRow(0);
    ArrayList<String> columns = getTableColumns(database, table);
    for (int i = 0; i < columns.size(); i++) {
        Cell cellA = headerRow.createCell(i);
        cellA.setCellValue(new HSSFRichTextString("" + columns.get(i)));
    }
    Drawing patriarch = sheet.createDrawingPatriarch();
    Cursor cursor = database.rawQuery("select * from " + table, null);
    cursor.moveToFirst();
    int n = 1;
    while (!cursor.isAfterLast()) {
        Row rowA = sheet.createRow(n);
        for (int j = 0; j < columns.size(); j++) {
            Cell cellA = rowA.createCell(j);
            if (cursor.getType(j) == Cursor.FIELD_TYPE_BLOB) {
                ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) j, n, (short) (j + 1), n + 1);
                anchor.setAnchorType(3);
                patriarch.createPicture(anchor, workbook.addPicture(cursor.getBlob(j), HSSFWorkbook.PICTURE_TYPE_JPEG));
            } else {
                String value = cursor.getString(j);
                if (value.length() >= 32767) {
                    value = value.substring(0, 32766);
                }
                cellA.setCellValue(new HSSFRichTextString(value));
            }
        }
        n++;
        cursor.moveToNext();
    }
    cursor.close();
}

[Buggy Hunk]
if (value.length() >= 32767) {

[Patch]
if (!TextUtils.isEmpty(value) && value.length() >= 32767) {

[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 ConfigurableApplicationContext bootstrapServiceContext(ConfigurableEnvironment environment, final SpringApplication application) {
    StandardEnvironment bootstrapEnvironment = new StandardEnvironment();
    MutablePropertySources bootstrapProperties = bootstrapEnvironment.getPropertySources();
    for (PropertySource<?> source : bootstrapProperties) {
        bootstrapProperties.remove(source.getName());
    }
    String configName = environment.resolvePlaceholders("${spring.cloud.bootstrap.name:bootstrap}");
    String configLocation = environment.resolvePlaceholders("${spring.cloud.bootstrap.location:}");
    Map<String, Object> bootstrapMap = new HashMap<>();
    bootstrapMap.put("spring.config.name", configName);
    if (StringUtils.hasText(configLocation)) {
        bootstrapMap.put("spring.config.location", configName);
    }
    bootstrapProperties.addFirst(new MapPropertySource(BOOTSTRAP_PROPERTY_SOURCE_NAME, bootstrapMap));
    bootstrapProperties.addFirst(new MapPropertySource("bootstrapInProgress", Collections.<String, Object>emptyMap()));
    for (PropertySource<?> source : environment.getPropertySources()) {
        bootstrapProperties.addLast(source);
    }
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    // Use names and ensure unique to protect against duplicates
    List<String> names = SpringFactoriesLoader.loadFactoryNames(BootstrapConfiguration.class, classLoader);
    // TODO: is it possible or sensible to share a ResourceLoader?
    SpringApplicationBuilder builder = new SpringApplicationBuilder().profiles(environment.getActiveProfiles()).showBanner(false).environment(bootstrapEnvironment).properties("spring.application.name:" + configName).web(false);
    List<Class<?>> sources = new ArrayList<>();
    for (String name : names) {
        Class<?> cls = ClassUtils.resolveClassName(name, null);
        try {
            cls.getDeclaredAnnotations();
        } catch (Exception e) {
            continue;
        }
        sources.add(cls);
    }
    builder.sources(sources.toArray(new Class[sources.size()]));
    final ConfigurableApplicationContext context = builder.run();
    // Make the bootstrap context a parent of the app context
    addAncestorInitializer(application, context);
    bootstrapProperties.remove("bootstrapInProgress");
    return context;
}

[Buggy Hunk]
bootstrapMap.put("spring.config.location", configName);

[Patch]
bootstrapMap.put("spring.config.location", configLocation);