<commit_before>package com.baidu.disconf.client.support.registry.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.baidu.disconf.client.support.registry.Registry;

/**
 * Created by knightliao on 15/11/26.
 */
public class SimpleRegistry implements Registry {

    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRegistry.class);

    @Override
    public <T> List<T> findByType(Class<T> type) {

        List<T> ret = new ArrayList<T>(1);

        try {
            ret.add(type.newInstance());
        } catch (InstantiationException e) {

            LOGGER.error("Failed to init " + type.getSimpleName() + " " + e.toString());

        } catch (IllegalAccessException e) {

            LOGGER.error("Failed to init " + type.getSimpleName() + " " + e.toString());
        }

        return ret;
    }

    @Override
    public <T> T getFirstByType(Class<T> type) {

        List<T> list = this.findByType(type);
        if (list.size() == 0) {
            return null;
        } else {
            return list.get(0);
        }
    }

    @Override
    public <T> T getFirstByType(Class<T> type, boolean withProxy) {
        return getFirstByType(type, withProxy);
    }
}<commit_msg>fix recursive call bug<commit_after>package com.baidu.disconf.client.support.registry.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.baidu.disconf.client.support.registry.Registry;

/**
 * Created by knightliao on 15/11/26.
 */
public class SimpleRegistry implements Registry {

    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRegistry.class);

    @Override
    public <T> List<T> findByType(Class<T> type) {

        List<T> ret = new ArrayList<T>(1);

        try {
            ret.add(type.newInstance());
        } catch (InstantiationException e) {

            LOGGER.error("Failed to init " + type.getSimpleName() + " " + e.toString());

        } catch (IllegalAccessException e) {

            LOGGER.error("Failed to init " + type.getSimpleName() + " " + e.toString());
        }

        return ret;
    }

    @Override
    public <T> T getFirstByType(Class<T> type) {

        List<T> list = this.findByType(type);
        if (list.size() == 0) {
            return null;
        } else {
            return list.get(0);
        }
    }

    @Override
    public <T> T getFirstByType(Class<T> type, boolean withProxy) {
        return getFirstByType(type);
    }
}
{'fraction_non_alphanumeric': 0.1264591439688716, 'fraction_numerical': 0.008560311284046693, 'mean_word_length': 2.5075034106412004, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4269162', 'n_tokens_mistral': 832, 'n_tokens_neox': 799, 'n_words': 174}