<commit_before>package HxCKDMS.HxCIssueServer;

import com.google.gson.Gson;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class HxCIssueServer {
    private static boolean running = true;
    private static ServerSocket serverSocket;
    private static Socket connection;
    private static BufferedReader reader;
    private static Gson gson = new Gson();

    public static String githubAuthenticationKey;

    public static void main(String[] args) {
        if(args.length != 2){
            System.err.println("Program doesn't accept less and more than 3 arguments [port] [github key]");
            System.exit(-1);
        }
        int port = Integer.parseInt(args[0]);
        githubAuthenticationKey = args[1];

        try{
            serverSocket = new ServerSocket(port, 100);
        } catch (IOException e) {
            System.err.println("Failed to bind to port: " + port + ".");
            running = false;
            System.exit(1);
        }

        while(running) {
            try {
                waitForConnection();
                setupInputStream();
                whileReceivingCrash();
                closeConnections();
            } catch (IOException e) {
                System.err.print("connection lost.");
            }
        }
    }

    private static void waitForConnection() throws IOException{
        System.out.println("waiting...");
        connection = serverSocket.accept();
        System.out.println("Connected to: " + connection.getInetAddress().getHostName());
    }

    private static void setupInputStream() throws IOException{
        reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        System.out.println("setting up streams done");
    }

    private static void whileReceivingCrash() throws IOException{
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) sb.append(line).append("\n");

        crashSendTemplate receivedFile = gson.fromJson(sb.toString(), crashSendTemplate.class);
        new GithubReporter(receivedFile.crash, receivedFile.mod, receivedFile.title).run();
    }

    private static void closeConnections() throws IOException{
        reader.close();
        connection.close();
    }

    class crashSendTemplate {
        String crash;
        String mod;
        String title;

        public crashSendTemplate(String crash, String mod, String title) {
            this.crash = crash;
            this.mod = mod;
            this.title = title;
        }
    }
}
<commit_msg>just printing stacktraces<commit_after>package HxCKDMS.HxCIssueServer;

import com.google.gson.Gson;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class HxCIssueServer {
    private static boolean running = true;
    private static ServerSocket serverSocket;
    private static Socket connection;
    private static BufferedReader reader;
    private static Gson gson = new Gson();

    public static String githubAuthenticationKey;

    public static void main(String[] args) {
        if(args.length != 2){
            System.err.println("Program doesn't accept less and more than 3 arguments [port] [github key]");
            System.exit(-1);
        }
        int port = Integer.parseInt(args[0]);
        githubAuthenticationKey = args[1];

        try{
            serverSocket = new ServerSocket(port, 100);
        } catch (IOException e) {
            System.err.println("Failed to bind to port: " + port + ".");
            running = false;
            System.exit(1);
        }

        while(running) {
            try {
                waitForConnection();
                setupInputStream();
                whileReceivingCrash();
                closeConnections();
            } catch (IOException e) {
                e.printStackTrace();
                System.err.println("connection lost.");
            }
        }
    }

    private static void waitForConnection() throws IOException{
        System.out.println("waiting...");
        connection = serverSocket.accept();
        System.out.println("Connected to: " + connection.getInetAddress().getHostName());
    }

    private static void setupInputStream() throws IOException{
        reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        System.out.println("setting up streams done");
    }

    private static void whileReceivingCrash() throws IOException{
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) sb.append(line).append("\n");

        crashSendTemplate receivedFile = gson.fromJson(sb.toString(), crashSendTemplate.class);
        new GithubReporter(receivedFile.crash, receivedFile.mod, receivedFile.title).run();
    }

    private static void closeConnections() throws IOException{
        reader.close();
        connection.close();
    }

    class crashSendTemplate {
        String crash;
        String mod;
        String title;

        public crashSendTemplate(String crash, String mod, String title) {
            this.crash = crash;
            this.mod = mod;
            this.title = title;
        }
    }
}

{'fraction_non_alphanumeric': 0.10171999260218235, 'fraction_numerical': 0.003329017939707786, 'mean_word_length': 2.356921166977033, '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': '2888520', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1354, 'n_words': 357}