<commit_before>package com.github.atave.cmis;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


/**
 * A {@link Properties} loader.
 */
public class Config {

    static Properties properties = new Properties();

    private static InputStream getResource(String name) {
        return Config.class.getClass().getResourceAsStream(name);
    }

    static {
        // Load global.properties
        Properties globalProperties = new Properties();
        try {
            globalProperties.load(getResource("/global.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }

        // Load local.properties
        try {
            properties.load(getResource("/local.properties"));
        } catch (IOException e) {
            properties = globalProperties;
        }

        // Set defaults
        if (globalProperties != properties) {
            for (String property : globalProperties.stringPropertyNames()) {
                if (properties.getProperty(property) == null) {
                    String value = globalProperties.getProperty(property);
                    properties.setProperty(property, value);
                }
            }
        }
    }

    public static String get(String name) {
        return properties.getProperty(name);
    }
}<commit_msg>made the properties loader ignore a missing local.properties file<commit_after>package com.github.atave.cmis;

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

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


/**
 * A {@link Properties} loader.
 */
public class Config {

    static Logger logger = LoggerFactory.getLogger(Config.class);

    static Properties properties = new Properties();

    private static InputStream getResource(String name) {
        return Config.class.getClass().getResourceAsStream(name);
    }

    static {
        // Load global.properties
        Properties globalProperties = new Properties();

        try (InputStream inputStream = getResource("/global.properties")) {
            if (inputStream != null) {
                globalProperties.load(inputStream);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        // Load local.properties
        try (InputStream inputStream = getResource("/local.properties")) {
            if (inputStream != null) {
                properties.load(inputStream);
            } else {
                properties = globalProperties;
            }
        } catch (IOException e) {
            properties = globalProperties;
        }

        // Set defaults
        if (properties != globalProperties) {
            for (String property : globalProperties.stringPropertyNames()) {
                if (properties.getProperty(property) == null) {
                    String value = globalProperties.getProperty(property);
                    properties.setProperty(property, value);
                }
            }
        }
    }

    /**
     * @see java.util.Properties#getProperty(String)
     */
    public static String get(String name) {
        String property = properties.getProperty(name);

        if (property == null) {
            logger.error("Property not found: {}", name);
        }

        return property;
    }
}
{'fraction_non_alphanumeric': 0.10134529147982063, 'fraction_numerical': 0.0005979073243647235, 'mean_word_length': 2.061299176578225, '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': '2766522', 'n_tokens_mistral': 801, 'n_tokens_neox': 780, 'n_words': 189}