[Demonstration 1]

[Buggy Method]
@Override
public void afterTextChanged(Editable editable) {
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setMinimumFractionDigits(digits);
    numberFormat.setMaximumFractionDigits(digits);
    try {
        String n = editable.toString().replaceAll(",", "");
        if (n.length() > 0) {
            Number number = numberFormat.parse(n);
            currentValue = number.doubleValue();
        }
    } catch (Exception e) {
        e.printStackTrace();
        currentValue = 1.0;
        editView.setText(R.string.num_one);
    }
    if (nameList != null) {
        valueList.clear();
        for (String name : nameList) {
            Double value = (currentValue / convertValue) * valueMap.get(name);
            String s = numberFormat.format(value);
            valueList.add(s);
        }
        adapter.notifyDataSetChanged();
    }
}

[Buggy Hunk]
String n = editable.toString().replaceAll(",", "");

[Patch]
String n = editable.toString();

[Demonstration 2]

[Buggy Method]
@Override
public void put(Object key, Object value) {
    data.put(value, value);
}

[Buggy Hunk]
data.put(value, value);

[Patch]
data.put(key, value);

[Demonstration 3]

[Buggy Method]
private static void appendObjectPropertyValue(Object propertyValue, Writer json, JSONConfig cfg) throws IOException {
    Map<?, ?> map = getJSONObjectMap(propertyValue);
    Set<String> propertyNames = cfg.isValidatePropertyNames() ? new HashSet<>(map.size()) : null;
    boolean didStart = false;
    boolean quoteIdentifier = cfg.isQuoteIdentifier();
    boolean havePadding = cfg.getIndentPadding() != null;
    // make a Javascript object with the keys used to generate the property names.
    json.write('{');
    IndentPadding.incPadding(cfg);
    for (Entry<?, ?> property : map.entrySet()) {
        String propertyName = getPropertyName(property.getKey(), cfg, propertyNames);
        Object value = property.getValue();
        boolean extraIndent = havePadding && isRecursible(value);
        if (didStart) {
            json.write(',');
        } else {
            didStart = true;
        }
        IndentPadding.appendPadding(cfg, json);
        appendPropertyName(propertyName, json, quoteIdentifier);
        IndentPadding.incAppendPadding(cfg, json, extraIndent);
        // recurse on the value.
        appendPropertyValue(value, json, cfg);
        IndentPadding.decAppendPadding(cfg, json, extraIndent);
    }
    IndentPadding.decAppendPadding(cfg, json);
    json.write('}');
}

[Buggy Hunk]
boolean extraIndent = havePadding && isRecursible(value);

[Patch]
boolean extraIndent = havePadding && value != null && isRecursible(value);