[Demonstration 1]

[Buggy Method]
public void addConfigurationProperties(Properties paramProperties) {
    this.properties.putAll(properties);
    this.suppressDate = StringUtility.isTrue(properties.getProperty("suppressDate"));
    this.suppressAllComments = StringUtility.isTrue(properties.getProperty("suppressAllComments"));
    this.suppressClassComment = StringUtility.isTrue(properties.getProperty("suppressClassComment"));
    this.showColumnName = StringUtility.isTrue(properties.getProperty("showColumnName"));
    this.showColumnJdbcType = StringUtility.isTrue(properties.getProperty("showColumnJdbcType"));
    this.showColumnDefaultValue = StringUtility.isTrue(properties.getProperty("showColumnDefaultValue"));
    this.showColumnRemark = StringUtility.isTrue(properties.getProperty("showColumnRemark"));
    this.dateFormatPattern = properties.getProperty("dateFormatPattern");
    if (!StringUtility.stringHasValue(dateFormatPattern)) {
        dateFormatPattern = "yyyy/MM/dd HH:mm:ss";
    }
    format = new SimpleDateFormat(dateFormatPattern);
}

[Buggy Hunk]
this.properties.putAll(properties);

[Patch]
this.properties.putAll(paramProperties);

[Demonstration 2]

[Buggy Method]
@SuppressWarnings("unchecked")
public void putValue(final String key, final String field, final String value, final long expire) {
    logger.info("putObject to redis data:" + key + field + value);
    redisTemplate.execute(new RedisCallback<String>() {

        @Override
        public String doInRedis(RedisConnection connection) throws DataAccessException {
            byte[] btyKey = redisTemplate.getStringSerializer().serialize(namespace + key);
            byte[] btyField = redisTemplate.getStringSerializer().serialize(field);
            byte[] btyValue = redisTemplate.getStringSerializer().serialize(value);
            connection.hSetNX(btyKey, btyField, btyValue);
            if (expire > 0)
                connection.expire(btyKey, expire);
            return null;
        }
    });
}

[Buggy Hunk]
connection.hSetNX(btyKey,btyField,btyValue);

[Patch]
connection.hSet(btyKey,btyField,btyValue);

[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;