<commit_before>package org.kurento.demo;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.kurento.commons.ConfigFileFinder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.stream.JsonReader;

public class ConfigurationReader {

	private static final Logger log = LoggerFactory.getLogger(ConfigurationReader.class);
	private static final Gson gson = new GsonBuilder().create();

	private JsonObject configFile;

	public ConfigurationReader(String configFileName) throws IOException {

		String configFile = ConfigFileFinder.getPathInClasspath(configFileName).toString();

		Path configFilePath = Paths.get(configFile);

		if (configFilePath == null) {
			log.debug("File not found {}", configFileName);
		}

		try (JsonReader reader = new JsonReader(Files.newBufferedReader(configFilePath, StandardCharsets.UTF_8))) {
			reader.setLenient(true);
			this.configFile = gson.fromJson(reader, JsonObject.class);

		} catch (NoSuchFileException e) {
			log.warn("Configuration file {} not found", configFilePath);
		} catch (IOException e) {
			log.error("Error opening config file {}", configFilePath, e);
		} catch (JsonParseException e) {
			log.error("Error parsing configuration file {}", configFilePath, e);
		}
	}

	public JsonObject getConfig() {
		return this.configFile;
	}
}<commit_msg>Refactor to use ClassPath.get()<commit_after>package org.kurento.demo;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.kurento.commons.ClassPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.stream.JsonReader;

public class ConfigurationReader {

	private static final Logger log = LoggerFactory
			.getLogger(ConfigurationReader.class);
	private static final Gson gson = new GsonBuilder().create();

	private JsonObject configFile;

	public ConfigurationReader(String configFileName) throws IOException {

		String configFile = ClassPath.get(configFileName).toString();

		Path configFilePath = Paths.get(configFile);

		if (configFilePath == null) {
			log.debug("File not found {}", configFileName);
		}

		try (JsonReader reader = new JsonReader(Files
				.newBufferedReader(configFilePath, StandardCharsets.UTF_8))) {
			reader.setLenient(true);
			this.configFile = gson.fromJson(reader, JsonObject.class);

		} catch (NoSuchFileException e) {
			log.warn("Configuration file {} not found", configFilePath);
		} catch (IOException e) {
			log.error("Error opening config file {}", configFilePath, e);
		} catch (JsonParseException e) {
			log.error("Error parsing configuration file {}", configFilePath, e);
		}
	}

	public JsonObject getConfig() {
		return this.configFile;
	}
}
{'fraction_non_alphanumeric': 0.11107692307692307, 'fraction_numerical': 0.0018461538461538461, 'mean_word_length': 5.300387596899225, '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': '6205415', 'n_tokens_mistral': 1032, 'n_tokens_neox': 967, 'n_words': 221}