[Demonstration 1]

[Buggy Method]
private void buildResolveList(Intent intent, FastImmutableArraySet<String> categories, boolean debug, boolean defaultOnly, String resolvedType, String scheme, F[] src, List<R> dest, int userId) {
    final String action = intent.getAction();
    final Uri data = intent.getData();
    final String packageName = intent.getPackage();
    final boolean excludingStopped = com.android.server.am.PreventRunningUtils.isExcludingStopped(intent);
    final Printer logPrinter;
    final PrintWriter logPrintWriter;
    if (debug) {
        logPrinter = new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM);
        logPrintWriter = new FastPrintWriter(logPrinter);
    } else {
        logPrinter = null;
        logPrintWriter = null;
    }
    final int N = src != null ? src.length : 0;
    boolean hasNonDefaults = false;
    int i;
    F filter;
    for (i = 0; i < N && (filter = src[i]) != null; i++) {
        int match;
        if (debug)
            Slog.v(TAG, "Matching against filter " + filter);
        if (excludingStopped && isFilterStopped(filter, userId)) {
            if (debug) {
                Slog.v(TAG, "  Filter's target is stopped; skipping");
            }
            continue;
        }
        // Is delivery being limited to filters owned by a particular package?
        if (packageName != null && !isPackageForFilter(packageName, filter)) {
            if (debug) {
                Slog.v(TAG, "  Filter is not from package " + packageName + "; skipping");
            }
            continue;
        }
        // Are we verified ?
        if (filter.getAutoVerify()) {
            if (localVerificationLOGV || debug) {
                Slog.v(TAG, "  Filter verified: " + isFilterVerified(filter));
                int authorities = filter.countDataAuthorities();
                for (int z = 0; z < authorities; z++) {
                    Slog.v(TAG, "   " + filter.getDataAuthority(z).getHost());
                }
            }
        }
        // Do we already have this one?
        if (!allowFilterResult(filter, dest)) {
            if (debug) {
                Slog.v(TAG, "  Filter's target already added");
            }
            continue;
        }
        match = com.android.server.am.PreventRunningUtils.match(filter.action, resolvedType, scheme, data, categories, TAG);
        if (match >= 0) {
            if (debug)
                Slog.v(TAG, "  Filter matched!  match=0x" + Integer.toHexString(match) + " hasDefault=" + filter.hasCategory(Intent.CATEGORY_DEFAULT));
            if (!defaultOnly || filter.hasCategory(Intent.CATEGORY_DEFAULT)) {
                final R oneResult = newResult(filter, match, userId);
                if (oneResult != null) {
                    dest.add(oneResult);
                    if (debug) {
                        dumpFilter(logPrintWriter, "    ", filter);
                        logPrintWriter.flush();
                        filter.dump(logPrinter, "    ");
                    }
                }
            } else {
                hasNonDefaults = true;
            }
        } else {
            if (debug) {
                String reason;
                switch(match) {
                    case IntentFilter.NO_MATCH_ACTION:
                        reason = "action";
                        break;
                    case IntentFilter.NO_MATCH_CATEGORY:
                        reason = "category";
                        break;
                    case IntentFilter.NO_MATCH_DATA:
                        reason = "data";
                        break;
                    case IntentFilter.NO_MATCH_TYPE:
                        reason = "type";
                        break;
                    default:
                        reason = "unknown reason";
                        break;
                }
                Slog.v(TAG, "  Filter did not match: " + reason);
            }
        }
    }
    if (debug && hasNonDefaults) {
        if (dest.size() == 0) {
            Slog.v(TAG, "resolveIntent failed: found match, but none with CATEGORY_DEFAULT");
        } else if (dest.size() > 1) {
            Slog.v(TAG, "resolveIntent: multiple matches, only some with CATEGORY_DEFAULT");
        }
    }
}

[Buggy Hunk]
match = com.android.server.am.PreventRunningUtils.match(filter. action, resolvedType, scheme, data, categories, TAG);

[Patch]
match = com.android.server.am.PreventRunningUtils.match(filter, action, resolvedType, scheme, data, categories, TAG);

[Demonstration 2]

[Buggy Method]
private void getSetting(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    int status = 404;
    String value = SystemProperties.get(req.getParameter("key"), String.class);
    if (value != null) {
        try (PrintWriter w = resp.getWriter()) {
            w.write(value);
        }
        status = 200;
    }
    resp.setStatus(status);
}

[Buggy Hunk]
String value = SystemProperties.get(req.getParameter("key"), String.class);

[Patch]
String value = SystemProperties.get(req.getParameter("key"), Object.class).toString();

[Demonstration 3]

[Buggy Method]
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    // int id = item.getItemId();
    switch(item.getItemId()) {
        case android.R.id.home:
            // app icon in action bar clicked; goto parent activity.
            this.finish();
            return true;
        case R.id.action_settings:
            return true;
        case 11:
            if (saveData(savePhoto())) {
                Intent intent = new Intent(getApplicationContext(), TripExpMan.class);
                intent.putExtra("ORIGIN", "EXPENSE");
                intent.putExtra("CLIENT", selectedClient.getId().toString());
                startActivity(intent);
            }
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
    //return super.onOptionsItemSelected(item);
}

[Buggy Hunk]
if(saveData(savePhoto())) {

[Patch]
if(saveData()) {