[Demonstration 1]

[Buggy Method]
public ValidateTaxNumberOut validateTaxNumber(String countryCode, String taxNumber) throws ApiException {
    // verify required params are set
    if (taxNumber == null) {
        throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/api/v1/tax/vat_numbers/{tax_number}/validate".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "taxNumber" + "\\}", apiInvoker.escapeString(taxNumber.toString()));
    // query params
    Map<String, String> queryParams = new HashMap<String, String>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, String> formParams = new HashMap<String, String>();
    if (!"null".equals(String.valueOf(countryCode)))
        queryParams.put("country_code", String.valueOf(countryCode));
    String[] contentTypes = { "application/json" };
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    try {
        String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
        if (response != null) {
            return (ValidateTaxNumberOut) ApiInvoker.deserialize(response, "", ValidateTaxNumberOut.class);
        } else {
            return null;
        }
    } catch (ApiException ex) {
        if (ex.getCode() == 404) {
            return null;
        } else {
            throw ex;
        }
    }
}

[Buggy Hunk]
String path = "/api/v1/tax/vat_numbers/{tax_number}/validate".replaceAll("\\{format\\}","json").replaceAll("\\{" + "taxNumber" + "\\}", apiInvoker.escapeString(taxNumber.toString()));

[Patch]
String path = "/api/v1/tax/vat_numbers/{tax_number}/validate".replaceAll("\\{format\\}","json").replaceAll("\\{" + "tax_number" + "\\}", apiInvoker.escapeString(taxNumber));

[Demonstration 2]

[Buggy Method]
private void shareChooser() {
    // specify our test image location
    Uri url = Uri.parse(mCurrentPhotoPath);
    // set up an intent to share the image
    Intent share_intent = new Intent();
    share_intent.setAction(Intent.ACTION_SEND);
    share_intent.setType("image/jpg");
    share_intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(url.toString())));
    share_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    share_intent.putExtra(Intent.EXTRA_SUBJECT, "Share this cat!");
    share_intent.putExtra(Intent.EXTRA_TEXT, mEditCatName.getText().toString() + ": " + mEditCatDesc.getText().toString());
    // start the intent
    try {
        startActivity(Intent.createChooser(share_intent, "ShareThroughChooser Test"));
    } catch (android.content.ActivityNotFoundException ex) {
        (new AlertDialog.Builder(NewCatActivity.this).setMessage("Share failed").setPositiveButton("OK", new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int whichButton) {
            }
        }).create()).show();
    }
}

[Buggy Hunk]
"ShareThroughChooser Test"));

[Patch]
"Sharing "+mEditCatName.getText().toString()));

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