[Demonstration 1]

[Buggy Method]
public void del(String variable) {
    Conf conf = this.get(variable);
    if (conf != null) {
        this.childNodes.remove(conf);
    }
}

[Buggy Hunk]
this.childNodes.remove(conf);

[Patch]
conf.getParentNode().getChildNodes().remove(conf);

[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]
private void loadProps() {
    String url = System.getProperty(SystemConstant.TSFILE_HOME, TSFileConfig.CONFIG_DEFAULT_PATH);
    InputStream inputStream = null;
    if (url.equals(TSFileConfig.CONFIG_DEFAULT_PATH)) {
        try {
            inputStream = new FileInputStream(new File(url));
        } catch (FileNotFoundException e) {
            LOGGER.warn("Fail to find config file {}", url, e);
            return;
        }
    } else {
        url = url + File.pathSeparator + "conf" + File.pathSeparator + TSFileConfig.CONFIG_NAME;
        try {
            File file = new File(url);
            inputStream = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            LOGGER.warn("Fail to find config file {}", url, e);
            return;
        }
    }
    LOGGER.info("Start to read config file {}", url);
    Properties properties = new Properties();
    try {
        properties.load(inputStream);
        conf.groupSizeInByte = Integer.parseInt(properties.getProperty("group_size_in_byte", conf.groupSizeInByte + ""));
        conf.pageSizeInByte = Integer.parseInt(properties.getProperty("page_size_in_byte", conf.pageSizeInByte + ""));
        conf.maxNumberOfPointsInPage = Integer.parseInt(properties.getProperty("max_number_of_points_in_page", conf.maxNumberOfPointsInPage + ""));
        conf.timeSeriesDataType = properties.getProperty("time_series_data_type", conf.timeSeriesDataType);
        conf.maxStringLength = Integer.parseInt(properties.getProperty("max_string_length", conf.maxStringLength + ""));
        conf.floatPrecision = Integer.parseInt(properties.getProperty("float_precision", conf.floatPrecision + ""));
        conf.timeSeriesEncoder = properties.getProperty("time_series_encoder", conf.timeSeriesEncoder);
        conf.valueEncoder = properties.getProperty("value_encoder", conf.valueEncoder);
        conf.compressor = properties.getProperty("compressor", conf.compressor);
    } catch (IOException e) {
        LOGGER.warn("Cannot load config file, use default configuration", e);
    } catch (Exception e) {
        LOGGER.error("Loading settings {} failed.", url, e);
        //System.exit(1);
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
                inputStream = null;
            } catch (IOException e) {
            }
        }
    }
}

[Buggy Hunk]
url = url + File.pathSeparator+"conf"+ File.pathSeparator + TSFileConfig.CONFIG_NAME;

[Patch]
url = url + File.separator+"conf"+ File.separator + TSFileConfig.CONFIG_NAME;