<commit_before>package edu.kit.ipd.crowdcontrol.workerservice;

import edu.kit.ipd.crowdcontrol.workerservice.database.DatabaseManager;
import edu.kit.ipd.crowdcontrol.workerservice.command.Commands;
import edu.kit.ipd.crowdcontrol.workerservice.database.operations.*;
import edu.kit.ipd.crowdcontrol.workerservice.objectservice.Communication;
import edu.kit.ipd.crowdcontrol.workerservice.query.Queries;
import org.jooq.SQLDialect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.naming.NamingException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Properties;
import java.util.function.Function;

/**
 * the main class is responsible for initialising everything.
 * @author LeanderK
 * @version 1.0
 */
public class Main {
    static {
        if (System.getProperty("logback.configurationFile") == null) {
            System.setProperty("logback.configurationFile", "./conf/logging.xml");
        }
    }
    private static Logger logger = LoggerFactory.getLogger(Main.class);
    private final Properties file;
    private final Properties system;
    private final boolean testing;

    public Main(boolean testing) {
        this.testing = testing;
        String configLocation = System.getProperty("workerservice.config");
        if (configLocation == null) {
            configLocation = "./conf/configuration.properties";
        }
        file = new Properties();
        try {
            try {
                file.load(new FileInputStream(configLocation));
            } catch (FileNotFoundException e) {
                //used for testing
                try {
                    file.load(Main.class.getResourceAsStream(configLocation));
                } catch (NullPointerException ignored) {
                    //just means it's also not in the jar
                }
            }
        } catch (IOException e) {
            logger.error("unable to find file {}", new File(configLocation).getAbsolutePath());
            System.exit(-1);
        }
        system = System.getProperties();
    }

    public static void main(String[] args) {
        //used for testing
        boolean testing = false;
        if (args.length == 1) {
            testing = Boolean.valueOf(args[0]);
        }
        Main main = new Main(testing);
        main.boot();
    }

    /**
     * initializes and starts the worker-service.
     */
    public void boot() {
        String url = getProperty("database.url");
        String username = getProperty("database.username");
        String password = getProperty("database.password");
        String databasePool = getProperty("database.poolName");

        SQLDialect dialect = null;
        try {
            dialect = SQLDialect.valueOf(getProperty("database.dialect").trim());
        } catch (IllegalArgumentException e) {
            logger.error("database.dialect not set");
            System.exit(-1);
        }<commit_msg>main: fixed bug<commit_after>package edu.kit.ipd.crowdcontrol.workerservice;

import edu.kit.ipd.crowdcontrol.workerservice.database.DatabaseManager;
import edu.kit.ipd.crowdcontrol.workerservice.command.Commands;
import edu.kit.ipd.crowdcontrol.workerservice.database.operations.*;
import edu.kit.ipd.crowdcontrol.workerservice.objectservice.Communication;
import edu.kit.ipd.crowdcontrol.workerservice.query.Queries;
import org.jooq.SQLDialect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.naming.NamingException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Properties;
import java.util.function.Function;

/**
 * the main class is responsible for initialising everything.
 * @author LeanderK
 * @version 1.0
 */
public class Main {
    static {
        if (System.getProperty("logback.configurationFile") == null) {
            System.setProperty("logback.configurationFile", "./conf/logging.xml");
        }
    }
    private static Logger logger = LoggerFactory.getLogger(Main.class);
    private final Properties file;
    private final Properties system;
    private final boolean testing;

    public Main(boolean testing) {
        this.testing = testing;
        String configLocation = System.getProperty("workerservice.config");
        if (configLocation == null) {
            configLocation = "./conf/configuration.properties";
        }
        file = new Properties();
        try {
            try {
                file.load(new FileInputStream(configLocation));
            } catch (FileNotFoundException e) {
                //used for testing
                try {
                    file.load(Main.class.getResourceAsStream(configLocation));
                } catch (NullPointerException ignored) {
                    //just means it's also not in the jar
                }
            }
        } catch (IOException e) {
            logger.error("unable to find file {}", new File(configLocation).getAbsolutePath());
            System.exit(-1);
        }
        system = System.getProperties();
    }

    public static void main(String[] args) {
        //used for testing
        boolean testing = false;
        if (args.length == 1) {
            testing = Boolean.valueOf(args[0]);
        }
        Main main = new Main(testing);
        main.boot();
    }

    /**
     * initializes and starts the worker-service.
     */
    public void boot() {
        String url = getProperty("database.url");
        String username = getProperty("database.username");
        String password = getProperty("<PASSWORD>");
        String databasePool = getProperty("database.poolName");

        SQLDialect dialect = null;
        try {
            dialect = SQLDialect.valueOf(getProperty("database.dialect").trim());
        } catch (NullPointerException e) {
            logger.error("database.dialect not set");
            System.exit(-1);
        }
{'fraction_non_alphanumeric': 0.10826869120316884, 'fraction_numerical': 0.0026406997854431426, 'mean_word_length': 2.4948096885813147, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5541560', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1588, 'n_words': 356}