[Demonstration 1]

[Buggy Method]
public JSONObject toJSONObject() {
    JSONObject json = new JSONObject();
    try {
        if (!TextUtils.isEmpty(userName)) {
            json.put("u", userName);
        }
        if (!TextUtils.isEmpty(handle)) {
            json.put("h", handle);
        }
        if (!TextUtils.isEmpty(phoneMobile)) {
            json.put("p", phoneMobile);
        }
        if (!TextUtils.isEmpty(avatar)) {
            json.put("a", avatar);
        }
        if (!TextUtils.isEmpty(description)) {
            json.put("d", description);
        }
        if (server_id > 0) {
            json.put("s", server_id);
        }
        if (_id > 0) {
            json.put("f", _id);
        }
    } catch (final Exception ex) {
        Log.d(TAG, "Error conveting to JSONObject" + ex.toString());
    }
    return json;
}

[Buggy Hunk]
Log.d(TAG, "Error conveting to JSONObject"+ex.toString());

[Patch]
Log.d("Friend", "Error conveting to JSONObject"+ex.toString());

[Demonstration 2]

[Buggy Method]
private static String generateDetailMessage(int index, int line, String source) {
    StringBuilder ret = new StringBuilder();
    int lineStart = source.lastIndexOf('\n', index - 1);
    int lineEnd = source.indexOf('\n', index);
    final int range = 2;
    String[] lines = new String[range * 2 + 1];
    if (lineStart == -1)
        lineStart = 0;
    else {
        int ls2 = lineStart;
        for (int i = 0; i < range; i++) {
            int ls3 = source.lastIndexOf('\n', ls2 - 1);
            if (ls3 == -1) {
                if (ls2 > 0)
                    ls3 = 0;
                else
                    break;
            }
            lines[range - 1 - i] = source.substring(ls3, ls2);
            ls2 = ls3;
        }
    }
    if (lineEnd == -1)
        lineEnd = source.length();
    else {
        int ls2 = lineEnd;
        for (int i = 0; i < range; i++) {
            int ls3 = source.indexOf('\n', ls2 + 1);
            if (ls3 == -1) {
                if (ls2 < source.length())
                    ls3 = source.length() - 2;
                else
                    break;
            }
            lines[range + 1 + i] = source.substring(ls2 + 1, ls3);
            ls2 = ls3;
        }
    }
    lines[range] = source.substring(Math.min(lineStart + 1, index), index) + " >>>" + source.substring(index, lineEnd);
    for (int i = 0; i < lines.length; i++) {
        String l = lines[i];
        if (l == null)
            continue;
        int lineNumber = line - range + i;
        ret.append(lineNumber).append(": ");
        ret.append(l);
        if (i != lines.length - 1) {
            ret.append('\n');
        }
    }
    return ret.toString();
}

[Buggy Hunk]
if (ls2 < source.length()) ls3 = source.length() - 2;

[Patch]
if (ls2 < source.length() - 1) ls3 = source.length() - 1;

[Demonstration 3]

[Buggy Method]
@Override
public void onError(final AIError error) {
    runOnUiThread(new Runnable() {

        @Override
        public void run() {
            Log.d(TAG, "onError");
            resultTextView.setText(error.toString());
        }
    });
}

[Buggy Hunk]
resultTextView.setText(error.toString());

[Patch]
jsonResults.setText(error.toString());