[Demonstration 1]

[Buggy Method]
public String getProperty(Key key) {
    if (key.defaultValue == null) {
        return properties.getProperty(key.propertyName);
    } else {
        return properties.getProperty(key.propertyName, (String) key.defaultValue);
    }
}

[Buggy Hunk]
return properties.getProperty(key.propertyName, (String)key.defaultValue);

[Patch]
return properties.getProperty(key.propertyName, String.valueOf(key.defaultValue));

[Demonstration 2]

[Buggy Method]
public JSONObject jsonizeObject(JSONObject json, Object o, JSONObject conf) {
    try {
        // FAIL DEFAULT
        if (o == null)
            return (json);
        json = (json != null) ? json : new JSONObject();
        conf = (conf != null) ? conf : new JSONObject();
        Integer rootConf = extractDotConf(conf.get("."), 0x0);
        // SKIP
        if ((rootConf & SKIP) != 0x0)
            return (json);
        // IS ENTITY
        ClassMetadata meta = this.cmn.getClassMetadata(o.getClass());
        if (meta == null)
            throw (new IllegalArgumentException("Argument o is not mapped entity, metadata not found:" + o.getClass().toString()));
        //json.put(meta.getIdentifierPropertyName(), meta.getIdentifier(o));
        String id = meta.getIdentifierPropertyName();
        if (id != null)
            json.put(id, getField(o, id).get(o));
        // ID_ONLY
        if ((rootConf & ID_ONLY) != 0x0) {
            return (json);
        }
        // RETAIN & EXCLUDE
        List<String> names = new ArrayList<String>(Arrays.asList(meta.getPropertyNames()));
        if ((rootConf & RETAIN_NAMED) != 0x0) {
            names.retainAll(conf.keySet());
            names.addAll(conf.keySet());
        }
        if ((rootConf & EXCLUDE_NAMED) != 0x0)
            names.retainAll(conf.keySet());
        if ((rootConf & INCLUDE_NAMED) != 0x0)
            names.addAll(conf.keySet());
        // SERIALIZE
        for (String s : names) {
            Integer nodeConf = extractDotConf(conf.get(s), ID_ONLY);
            // SKIP
            if ((nodeConf & SKIP) != 0x0)
                continue;
            Field f = getField(o, s);
            Class c = f.getType();
            // PRIMITIVE
            if (this.pc.isPrimitive(c)) {
                json.put(s, f.get(o));
                continue;
            }
            // ENTITY
            if (this.cmn.getClassMetadata(c) != null) {
                json.put(s, this.jsonizeObject(null, f.get(o), wrapDotConf(conf.get(s), nodeConf)));
                continue;
            }
            // ARRAY
            if (c.isArray()) {
                if (this.pc.isPrimitive(c.getComponentType())) {
                    json.put(s, f.get(o));
                    continue;
                }
                // else
                // {
                json.put(s, this.jsonizeArray(null, (Object[]) f.get(o), wrapDotConf(conf.get(s), nodeConf)));
                continue;
                // }
            }
            // COLLECTION
            if (Collection.class.isAssignableFrom(c)) {
                json.put(s, this.jsonizeCollection(null, (Collection) f.get(o), wrapDotConf(conf.get(s), nodeConf)));
                continue;
            }
            // default
            // {
            json.put(s, JSON.toJSON(f.get(o)));
            // }
        }
    } catch (IllegalAccessException ex) {
        throw (new RuntimeException(ex));
    }
    return (json);
}

[Buggy Hunk]
names.retainAll(conf.keySet());

[Patch]
names.removeAll(conf.keySet());

[Demonstration 3]

[Buggy Method]
public boolean getBoolean(String key) {
    if (!this.containsKey(key.toLowerCase()))
        return false;
    return (boolean) this.getProperty(key.toLowerCase());
}

[Buggy Hunk]
return (boolean) this.getProperty(key.toLowerCase());

[Patch]
return Util.asBoolean(this.getString(key.toLowerCase()));