<commit_before>package client;

import client.command.Commands;
import client.command.ICommand;
import client.net.ClientInitializer;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

import proto.Message.MessageWrapper;
import proto.Message.MessageChat;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Timestamp;

public class Client {

    private static final int SERVER_PORT = 8000;

    public static void main(String[] args) {
        Client client = new Client("localhost", SERVER_PORT);

        try {
            client.run();
        }
        catch (Exception e) {
            System.out.println(e.toString());
        }
        finally {
            if (client.serverChannel.isOpen())
                client.serverChannel.close();
        }
    }

    private Channel serverChannel = null;
    private final String host;
    private final int port;

    private Client(String host, int port) {
        this.host = host;
        this.port = port;
    }

    private void sendMsg(String msg) {
        this.serverChannel.writeAndFlush(
                MessageWrapper.newBuilder()
                        .setType(MessageWrapper.MessageType.CHAT)
                        .setChat(MessageChat.newBuilder().setText(msg).build())
                        .setTimestamp(new Timestamp(System.currentTimeMillis()).getTime())
                        .setCode(0)
                        .build()
        );
    }

    private void checkMsg(String msg) {
        if (msg.startsWith("/")) {
            try {
                ((ICommand)(Commands.from(msg).newInstance())).run(msg, this.serverChannel);
            } catch (Exception e) {<commit_msg>Fix nullPtr Exception<commit_after>package client;

import client.command.Commands;
import client.command.ICommand;
import client.net.ClientInitializer;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

import proto.Message.MessageWrapper;
import proto.Message.MessageChat;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Timestamp;

public class Client {

    private static final int SERVER_PORT = 8000;

    public static void main(String[] args) {
        Client client = new Client("localhost", SERVER_PORT);

        try {
            client.run();
        }
        catch (Exception e) {
            System.out.println(e.toString());
        }
        finally {
            if (client.serverChannel != null && client.serverChannel.isOpen())
                client.serverChannel.close();
        }
    }

    private Channel serverChannel = null;
    private final String host;
    private final int port;

    private Client(String host, int port) {
        this.host = host;
        this.port = port;
    }

    private void sendMsg(String msg) {
        this.serverChannel.writeAndFlush(
                MessageWrapper.newBuilder()
                        .setType(MessageWrapper.MessageType.CHAT)
                        .setChat(MessageChat.newBuilder().setText(msg).build())
                        .setTimestamp(new Timestamp(System.currentTimeMillis()).getTime())
                        .setCode(0)
                        .build()
        );
    }

    private void checkMsg(String msg) {
        if (msg.startsWith("/")) {
            try {
                ((ICommand)(Commands.from(msg).newInstance())).run(msg, this.serverChannel);
            } catch (Exception e) {
{'fraction_non_alphanumeric': 0.10558839333691564, 'fraction_numerical': 0.0026867275658248252, 'mean_word_length': 2.24869109947644, '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': '1773359', 'n_tokens_mistral': 1021, 'n_tokens_neox': 996, 'n_words': 208}