[Demonstration 1]

[Buggy Method]
@Override
public Object apply(String str, Options options) throws IOException {
    if (str == null) {
        return "";
    }
    Document document = Jsoup.parseBodyFragment(str);
    document.outputSettings().syntax(Document.OutputSettings.Syntax.xml);
    String ret = document.body().html();
    try {
        validateXml(ret);
        return sanitize(ret);
    } catch (Exception e) {
        return "<div class=\"element-error\">" + document.body().text() + "</div>";
    }
}

[Buggy Hunk]
return "<div class=\"element-error\">" + document.body().text()+ "</div>";

[Patch]
return "<div class=\"element-error\">" + sanitize(document.body().text()) + "</div>";

[Demonstration 2]

[Buggy Method]
@Override
protected String doInBackground(Void... params) {
    for (int i = 0; i < nSample; i++) {
        float[] coords = bb.getSample(nextPoint());
        if (-1 == dbHelper.addValue(i, SampleType.SAMPLE, coords[0], coords[1])) {
            Log.d("DBentry", "Failed to insert row in the database");
            return null;
        }
    }
    for (int i = 0; i < nOversample; i++) {
        float[] coords = bb.getSample(nextPoint());
        if (-1 == dbHelper.addValue(i, SampleType.OVERSAMPLE, coords[0], coords[1])) {
            Log.d("DBentry", "Failed to insert row in the database");
            return null;
        }
    }
    Log.d("generate", dbHelper.prettyPrint());
    return "stdout!";
}

[Buggy Hunk]
if(-1==dbHelper.addValue(i,SampleType.OVERSAMPLE,coords[0],coords[1])){

[Patch]
if(-1==dbHelper.addValue(i+nSample,SampleType.OVERSAMPLE,coords[0],coords[1])){

[Demonstration 3]

[Buggy Method]
@Override
protected Void doInBackground(Void... voids) {
    try {
        readJson();
    } catch (Exception e) {
        error = true;
        Log.e("", "Could not read JSON", e);
    }
    return null;
}

[Buggy Hunk]
Log.e("", "Could not read JSON", e);

[Patch]
Log.e(TAG, "Could not read JSON", e);