<commit_before>package com.jayway.jsonpath.spi.cache;

import com.jayway.jsonpath.JsonPathException;

public class CacheProvider {
    private static Cache cache = new LRUCache(200);

    public static void setCache(Cache cache){
        if (cache != null){
            CacheProvider.cache = cache;
        }
    }

    public static Cache getCache() {
        try {
            return cache;
        } catch (Exception e) {
            throw new JsonPathException("Failed to get cache", e);
        }
    }
}<commit_msg>Stricter configuration of CacheProvide.<commit_after>package com.jayway.jsonpath.spi.cache;

import com.jayway.jsonpath.JsonPathException;

import static com.jayway.jsonpath.internal.Utils.notNull;

public class CacheProvider {
    private static Cache cache;

    public static void setCache(Cache cache){
        notNull(cache, "Cache may not be null");
        synchronized (CacheProvider.class){
            if(CacheProvider.cache != null){
                throw new JsonPathException("Cache provider must be configured before cache is accessed.");
            } else {
                CacheProvider.cache = cache;
            }
        }
    }

    public static Cache getCache() {
        if(CacheProvider.cache == null){
            synchronized (CacheProvider.class){
                if(CacheProvider.cache == null){
                    CacheProvider.cache = getDefaultCache();
                }
            }
        }
        return CacheProvider.cache;
    }


    private static Cache getDefaultCache(){
        return new LRUCache(200);
    }
}
{'fraction_non_alphanumeric': 0.08871989860583017, 'fraction_numerical': 0.0038022813688212928, 'mean_word_length': 2.145418326693227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2655155', 'n_tokens_mistral': 421, 'n_tokens_neox': 401, 'n_words': 107}