<commit_before>package io.github.monitool.sensors;

import io.github.monitool.sensors.jsonModels.HostName;
import io.github.monitool.sensors.jsonModels.RegistrationJson;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class SensorConfiguration {
	private static SensorConfiguration configuration;

	private String serverAddres;
	private String sensorId;
	private String sendingCronExp;
	private PropertiesConfiguration config;

	private SensorConfiguration() {

		config = null;
		ensureConfigFileExisting();
		try {
			config = new PropertiesConfiguration("application.properties");
			serverAddres = config.getString("server.ip", null);
			if (serverAddres == null) {
				serverAddres = "http://monitool.herokuapp.com/";
				updateConfig("server.ip", serverAddres);
			}
			sendingCronExp = config.getString("sensor.cron.exp", null);
			if (sendingCronExp == null) {
				sendingCronExp = "0/1 * * * * ?";
				updateConfig("sensor.cron.exp", sendingCronExp);
			}
			sensorId = config.getString("sensor.id", null);
			if (sensorId == null) {
				registerSensor();
			}

		} catch (ConfigurationException e) {
			e.printStackTrace();<commit_msg>parsing serwer adres<commit_after>package io.github.monitool.sensors;

import io.github.monitool.sensors.jsonModels.HostName;
import io.github.monitool.sensors.jsonModels.RegistrationJson;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class SensorConfiguration {
	private static SensorConfiguration configuration;

	private String serverAddres;
	private String sensorId;
	private String sendingCronExp;
	private PropertiesConfiguration config;

	private SensorConfiguration() {

		config = null;
		ensureConfigFileExisting();
		try {
			config = new PropertiesConfiguration("application.properties");
			serverAddres = config.getString("server.ip", null);
			if (!serverAddres.endsWith("/"))
				serverAddres += "/";
			if (serverAddres == null) {
				serverAddres = "http://monitool.herokuapp.com/";
				updateConfig("server.ip", serverAddres);
			}
			sendingCronExp = config.getString("sensor.cron.exp", null);
			if (sendingCronExp == null) {
				sendingCronExp = "0/1 * * * * ?";
				updateConfig("sensor.cron.exp", sendingCronExp);
			}
			sensorId = config.getString("sensor.id", null);
			if (sensorId == null) {
				registerSensor();
			}

		} catch (ConfigurationException e) {
			e.printStackTrace();
{'fraction_non_alphanumeric': 0.11724386724386725, 'fraction_numerical': 0.001443001443001443, 'mean_word_length': 4.950643776824034, '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': '2894721', 'n_tokens_mistral': 909, 'n_tokens_neox': 807, 'n_words': 158}